]> git.ipfire.org Git - thirdparty/gcc.git/commit
sccp: Fix order of removal of phi (again) [PR122599]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 7 Nov 2025 22:01:33 +0000 (14:01 -0800)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Sat, 8 Nov 2025 02:11:30 +0000 (18:11 -0800)
commit77e10b47f25d05d51a187822fe6a8366a6d68d67
tree08d87a0bdcc5ea31d6ab5667f3f5326136f81fd1
parentcbded1ce012d6444d4ff8adbad047cf04220fe1b
sccp: Fix order of removal of phi (again) [PR122599]

This time we are gimplifying the expression and call
fold_stmt during the gimplification (which is fine) but
since we removed the phi and the expression references ssa
names in the phi indirectly, things just fall over inside the ranger.

This moves the removal of the phi until gimplification happens as it
might refer back to the ssa name that the phi defines.

Pushed as obvious after bootstrap test on x86_64-linux-gnu.

PR tree-optimization/122599

gcc/ChangeLog:

* tree-scalar-evolution.cc (final_value_replacement_loop): Move
the removal of the phi until after the gimplification of the final
value expression.

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr122599-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/testsuite/gcc.dg/torture/pr122599-1.c [new file with mode: 0644]
gcc/tree-scalar-evolution.cc