aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-05-07 09:43:54 +0200
committerRichard Biener <rguenth@gcc.gnu.org>2025-05-08 08:36:53 +0200
commitda377e7ebf84a05943fb768eaeb7d682dee865fa (patch)
tree945ca1ee4f317e1595798d37f2babac28ffc38c4
parent9def392a1b63a198d15d972f73b4afc888389d7c (diff)
downloadgcc-da377e7ebf84a05943fb768eaeb7d682dee865fa.zip
gcc-da377e7ebf84a05943fb768eaeb7d682dee865fa.tar.gz
gcc-da377e7ebf84a05943fb768eaeb7d682dee865fa.tar.bz2
tree-optimization/120143 - ICE with failed early break store move
The early break vectorization store moving was incorrectly trying to move the pattern stmt instead of the original one which failed to register and then confused virtual SSA form due to the update triggered by a degenerate virtual PHI. PR tree-optimization/120143 * tree-vect-data-refs.cc (vect_analyze_early_break_dependences): Move/update the original stmts, not the pattern stmts which lack virtual operands and are not in the IL. * gcc.dg/vect/vect-early-break_135-pr120143.c: New testcase.
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c18
-rw-r--r--gcc/tree-vect-data-refs.cc1
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c
new file mode 100644
index 0000000..1ee30a8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-add-options vect_early_break } */
+/* { dg-additional-options "-O3 -fwhole-program" } */
+
+short a;
+extern _Bool b[][23];
+short g = 6;
+int v[4];
+int x[3];
+void c(short g, int v[], int x[]) {
+ for (;;)
+ for (unsigned y = 0; y < 023; y++) {
+ b[y][y] = v[y];
+ for (_Bool aa = 0; aa < (_Bool)g; aa = x[y])
+ a = a > 0;
+ }
+}
+int main() { c(g, v, x); }
diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
index 231a3ca..9fd1ef2 100644
--- a/gcc/tree-vect-data-refs.cc
+++ b/gcc/tree-vect-data-refs.cc
@@ -734,7 +734,6 @@ vect_analyze_early_break_dependences (loop_vec_info loop_vinfo)
stmt_vec_info stmt_vinfo
= vect_stmt_to_vectorize (loop_vinfo->lookup_stmt (stmt));
- stmt = STMT_VINFO_STMT (stmt_vinfo);
auto dr_ref = STMT_VINFO_DATA_REF (stmt_vinfo);
if (!dr_ref)
continue;