tree-optimization/100492 - avoid irreducible regions in loop distribution
authorRichard Biener <rguenther@suse.de>
Mon, 10 May 2021 09:37:27 +0000 (11:37 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 10 May 2021 11:05:58 +0000 (13:05 +0200)
commit60af2db18013a0339302928ba98fee893ccc1957
tree88a9e0c0e46e838e441917a516385ce5a032ff33
parentcc1d563887b1fe3183a21572b2ea63466b2bfa3a
tree-optimization/100492 - avoid irreducible regions in loop distribution

When we distribute away a condition we rely on the ability to
change it to either 1 != 0 or 0 != 0 depending on the direction
of the exit branch in the respective loop.  But when the loop
contains an irreducible sub-region then for the conditions inside
this this fails and can lead to infinite loops being generated.

Avoid distibuting loops with irreducible sub-regions.

2021-05-10  Richard Biener  <rguenther@suse.de>

PR tree-optimization/100492
* tree-loop-distribution.c (find_seed_stmts_for_distribution):
Find nothing when the loop contains an irreducible region.

* gcc.dg/torture/pr100492.c: New testcase.
gcc/testsuite/gcc.dg/torture/pr100492.c [new file with mode: 0644]
gcc/tree-loop-distribution.c