This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR42916


This fixes PR42916 where we do not properly disregard DEBUG_STMTs
during stmt counting.  This causes code-generation differences
with basic-block vectorization.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2010-02-19  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42916
	* tree-vect-slp.c (vect_slp_analyze_bb): Count only real
	instructions.

	* gcc.dg/pr42916.c: New testcase.

Index: gcc/tree-vect-slp.c
===================================================================
*** gcc/tree-vect-slp.c	(revision 156894)
--- gcc/tree-vect-slp.c	(working copy)
*************** vect_slp_analyze_bb (basic_block bb)
*** 1273,1279 ****
      fprintf (vect_dump, "===vect_slp_analyze_bb===\n");
  
    for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
!     insns++;
  
    if (insns > PARAM_VALUE (PARAM_SLP_MAX_INSNS_IN_BB))
      {
--- 1273,1285 ----
      fprintf (vect_dump, "===vect_slp_analyze_bb===\n");
  
    for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
!     {
!       gimple stmt = gsi_stmt (gsi);
!       if (!is_gimple_debug (stmt)
! 	  && !gimple_nop_p (stmt)
! 	  && !gimple_code (stmt) == GIMPLE_LABEL)
! 	insns++;
!     }
  
    if (insns > PARAM_VALUE (PARAM_SLP_MAX_INSNS_IN_BB))
      {
Index: gcc/testsuite/gcc.dg/pr42916.c
===================================================================
*** gcc/testsuite/gcc.dg/pr42916.c	(revision 0)
--- gcc/testsuite/gcc.dg/pr42916.c	(revision 0)
***************
*** 0 ****
--- 1,20 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O1 -funroll-loops -ftree-vectorize -fcompare-debug" } */
+ 
+ int seed;
+ 
+ static inline int hash(const char *str)
+ {
+   int h = seed++;
+   int i = 12;
+   while (i--)
+     h += (h << 3) ^ *str++;
+   return h;
+ }
+ 
+ void f(const char *str, int *h)
+ {
+   int i = 6;
+   while (i--)
+     *h++ = hash(str);
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]