Refine fix for PR78185, improve LIM for code after inner loops
authorRichard Biener <rguenther@suse.de>
Thu, 2 Sep 2021 08:47:35 +0000 (10:47 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 2 Sep 2021 09:39:27 +0000 (11:39 +0200)
commit483e400870601f650c80f867ec781cd5f83507d6
treee61ffe6f5d993c5d330dbbb5df667f96caa2e36a
parent2af6dd77ea742d4ee911f466878624972929508a
Refine fix for PR78185, improve LIM for code after inner loops

This refines the fix for PR78185 after understanding that the code
regarding to the comment 'In a loop that is always entered we may
proceed anyway.  But record that we entered it and stop once we leave
it.' was supposed to protect us from leaving possibly infinite inner
loops.  The simpler fix of moving the misplaced stopping code
can then be refined to continue processing when the exited inner
loop is finite, improving invariant motion for cases like in the
added testcase.

2021-09-02  Richard Biener  <rguenther@suse.de>

* tree-ssa-loop-im.c (fill_always_executed_in_1): Refine
fix for PR78185 and continue processing when leaving
finite inner loops.

* gcc.dg/tree-ssa/ssa-lim-16.c: New testcase.
gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-16.c [new file with mode: 0644]
gcc/tree-ssa-loop-im.c