aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-12-04 15:46:38 +0100
committerRichard Biener <rguenther@suse.de>2023-12-05 08:26:04 +0100
commit50f2a3370d177f8fe9bea0461feb710523e048a2 (patch)
tree60963967b0fce26e03de85a45388aec1238bff0f
parentb1cb2d993cc1148281fb4922a7ae26a4ae9ecf6f (diff)
downloadgcc-50f2a3370d177f8fe9bea0461feb710523e048a2.zip
gcc-50f2a3370d177f8fe9bea0461feb710523e048a2.tar.gz
gcc-50f2a3370d177f8fe9bea0461feb710523e048a2.tar.bz2
tree-optimization/112827 - more SCEV cprop fixes
The insert iteration can be corrupted by foldings of replace_uses_by, within this particular PHI replacement but also with subsequent ones. Recompute the insert location before insertion instead. This fixes an obvserved ICE of gcc.dg/tree-ssa/ssa-sink-16.c. PR tree-optimization/112827 PR tree-optimization/112848 * tree-scalar-evolution.cc (final_value_replacement_loop): Compute the insert location for each insert.
-rw-r--r--gcc/tree-scalar-evolution.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/tree-scalar-evolution.cc b/gcc/tree-scalar-evolution.cc
index 7556d89..385fc64 100644
--- a/gcc/tree-scalar-evolution.cc
+++ b/gcc/tree-scalar-evolution.cc
@@ -3739,7 +3739,6 @@ final_value_replacement_loop (class loop *loop)
split_loop_exit_edge (exit);
/* Set stmt insertion pointer. All stmts are inserted before this point. */
- gimple_stmt_iterator gsi = gsi_after_labels (exit->dest);
class loop *ex_loop
= superloop_at_depth (loop,
@@ -3880,6 +3879,7 @@ final_value_replacement_loop (class loop *loop)
gsi_next (&gsi2);
}
}
+ gimple_stmt_iterator gsi = gsi_after_labels (exit->dest);
gsi_insert_seq_before (&gsi, stmts, GSI_SAME_STMT);
if (dump_file)
{