aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-01-11 16:02:23 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-01-11 16:02:23 +0000
commit62446e6e25e2483e1ec5c3bfb119833fab0dd218 (patch)
tree5d7520898bbd7542c9de33d1ab99f3bdea430f87
parent3a28db463b4d0ce7ee87a85ab2dbcb68eda9ef22 (diff)
downloadgcc-62446e6e25e2483e1ec5c3bfb119833fab0dd218.zip
gcc-62446e6e25e2483e1ec5c3bfb119833fab0dd218.tar.gz
gcc-62446e6e25e2483e1ec5c3bfb119833fab0dd218.tar.bz2
re PR tree-optimization/69173 (ICE (segfault) in vinfo_for_stmt)
2016-01-11 Richard Biener <rguenther@suse.de> PR tree-optimization/69173 * tree-vect-loop.c (vect_fixup_scalar_cycles_with_patterns): Only fixup the cycle if all stmts are in a pattern. * gcc.dg/torture/pr69173.c: New testcase. From-SVN: r232230
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr69173.c12
-rw-r--r--gcc/tree-vect-loop.c18
4 files changed, 38 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 62aaea2..a256b34 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-01-11 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/69173
+ * tree-vect-loop.c (vect_fixup_scalar_cycles_with_patterns): Only
+ fixup the cycle if all stmts are in a pattern.
+
2016-01-11 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/68999
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6366b49..414c174 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-11 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/69173
+ * gcc.dg/torture/pr69173.c: New testcase.
+
2016-01-11 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/68796
diff --git a/gcc/testsuite/gcc.dg/torture/pr69173.c b/gcc/testsuite/gcc.dg/torture/pr69173.c
new file mode 100644
index 0000000..f2936ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr69173.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+unsigned a;
+unsigned *b;
+void fn1() {
+ char c;
+ while (b < (unsigned *)fn1)
+ {
+ a += b[2] + c;
+ b++;
+ }
+}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index a82cf26..a797f70 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -985,9 +985,21 @@ vect_fixup_scalar_cycles_with_patterns (loop_vec_info loop_vinfo)
FOR_EACH_VEC_ELT (LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo), i, first)
if (STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (first)))
{
- vect_fixup_reduc_chain (first);
- LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo)[i]
- = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (first));
+ gimple *next = GROUP_NEXT_ELEMENT (vinfo_for_stmt (first));
+ while (next)
+ {
+ if (! STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (next)))
+ break;
+ next = GROUP_NEXT_ELEMENT (vinfo_for_stmt (next));
+ }
+ /* If not all stmt in the chain are patterns try to handle
+ the chain without patterns. */
+ if (! next)
+ {
+ vect_fixup_reduc_chain (first);
+ LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo)[i]
+ = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (first));
+ }
}
}