re PR tree-optimization/42916 ("-fcompare-debug failure" with "-O1 -funroll-loops...
authorRichard Guenther <rguenther@suse.de>
Fri, 19 Feb 2010 15:42:31 +0000 (15:42 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 19 Feb 2010 15:42:31 +0000 (15:42 +0000)
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.

From-SVN: r156898

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr42916.c [new file with mode: 0644]
gcc/tree-vect-slp.c

index 1d230c47bb6131ce5101f4c0c56b096cc87688a5..c516bb89944dd4d59f39c46f19575f5679d66ff8 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-19  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/42916
+       * tree-vect-slp.c (vect_slp_analyze_bb): Count only real
+       instructions.
+
 2010-02-19  Andreas Schwab  <schwab@linux-m68k.org>
 
        * configure.ac: Replace all uses of changequote in macro arguments
index 10f8fffb305870c411dae7c175bd237d7e197503..ff44628f4c1aca5304eaa339cba5d25e423ed12d 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-19  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/42916
+       * gcc.dg/pr42916.c: New testcase.
+
 2010-02-18  Jason Merrill  <jason@redhat.com>
 
        PR c++/42837
diff --git a/gcc/testsuite/gcc.dg/pr42916.c b/gcc/testsuite/gcc.dg/pr42916.c
new file mode 100644 (file)
index 0000000..d32ba94
--- /dev/null
@@ -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 5a11b84a95347fa9d8d9fa318df551c704969e37..ee4807a80348fa0295fc32d10e371196d562fd31 100644 (file)
@@ -1273,7 +1273,13 @@ vect_slp_analyze_bb (basic_block bb)
     fprintf (vect_dump, "===vect_slp_analyze_bb===\n");
 
   for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
-    insns++;
+    {
+      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))
     {