Fix shrink-wrapping bug (PR67778, PR68634)
commit7af735bee09f305906f31e7b5a51d5229fa49c5a
authorsegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Dec 2015 00:27:14 +0000 (11 00:27 +0000)
committersegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Dec 2015 00:27:14 +0000 (11 00:27 +0000)
treedc15978b0076a05b78a6f5c3f29688925bde398f
parentb1d369b60bc0dbf7008f931ad56cf5163ec63b93
Fix shrink-wrapping bug (PR67778, PR68634)

After shrink-wrapping has found the "tightest fit" for where to place
the prologue, it tries move it earlier (so that frame saves are run
earlier) -- but without copying any more basic blocks.

Unfortunately a candidate block we select can be inside a loop, and we
will still allow it (because the loop always exits via our previously
chosen block).  We can do that just fine if we make a duplicate of the
block, but we do not want to here.

So we need to detect this situation.  We can place the prologue at a
previous block PRE only if PRE dominates every block reachable from
it, because then we will never need to duplicate that block (it will
always be executed with prologue).

2015-12-11  Segher Boessenkool  <segher@kernel.crashing.org>

PR rtl-optimization/67778
PR rtl-optimization/68634
* shrink-wrap.c (try_shrink_wrapping): Add a comment about why we want
to put the prologue earlier.  When determining if an earlier block is
suitable, make sure it dominates every block reachable from it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231552 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/shrink-wrap.c