tree-optimization/112856 - fix LC SSA after loop header copying
commit8ff02df62935429d8956361cfdb897122492523d
authorRichard Biener <rguenther@suse.de>
Tue, 5 Dec 2023 07:50:57 +0000 (5 08:50 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 5 Dec 2023 13:12:12 +0000 (5 14:12 +0100)
tree62975ad33b29b7eb69e157a79d07642c9eea12b2
parente0786ca9a18c50ad08c40936b228e325193664b8
tree-optimization/112856 - fix LC SSA after loop header copying

When loop header copying unloops loops we have to possibly fixup
LC SSA.  I've take the opportunity to streamline the unloop_loops
API, removing the use of a ivcanon local global variable.

PR tree-optimization/109689
PR tree-optimization/112856
* cfgloopmanip.h (unloop_loops): Adjust API.
* tree-ssa-loop-ivcanon.cc (unloop_loops): Take edges_to_remove
as parameter.
(canonicalize_induction_variables): Adjust.
(tree_unroll_loops_completely): Likewise.
* tree-ssa-loop-ch.cc (ch_base::copy_headers): Rewrite into
LC SSA if we unlooped some loops and we are in LC SSA.

* gcc.dg/torture/pr109689.c: New testcase.
* gcc.dg/torture/pr112856.c: Likewise.
gcc/cfgloopmanip.h
gcc/testsuite/gcc.dg/torture/pr109689.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr112856.c [new file with mode: 0644]
gcc/tree-ssa-loop-ch.cc
gcc/tree-ssa-loop-ivcanon.cc