]> gcc.gnu.org Git - gcc.git/commit
shrink-wrap: Improve spread_components (PR85645)
authorSegher Boessenkool <segher@kernel.crashing.org>
Wed, 9 May 2018 12:48:43 +0000 (14:48 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Wed, 9 May 2018 12:48:43 +0000 (14:48 +0200)
commit826f35d8124731d0f4f5415c84fb59d2b6adf58b
tree1910a313b5a9cb60b3a35d1183deadcd113a548a
parent97741c118180621e47edb6350571077eb0bc28ca
shrink-wrap: Improve spread_components (PR85645)

In the testcase for PR85645 we do a pretty dumb placement of the
prologue/epilogue for the LR component: we place an epilogue for LR
before a control flow split where one of the branches clobbers LR
eventually, and the other does not.  The branch that does clobber it
will need a prologue again some time later.  Because saving and
restoring LR is a two step process---it needs to be moved via a GPR---
the backend emits CFI directives so that we get correct unwind
information.  But both regcprop and regrename do not properly handle
such CFI directives leading to ICEs.

Now, neither of the two branches needs to have LR restored at all,
because both of the branches end up in an infinite loop.

This patch makes spread_component return a boolean saying if anything
was changed, and if so, it is called again.  This obviously is finite
(there is a finite number of basic blocks, each with a finite number
of components, and spread_components can only assign more components
to a block, never less).  I also instrumented the code, and on a
bootstrap+regtest spread_components made changes a maximum of two
times.  Interestingly though it made changes on two iterations in
a third of the cases it did anything at all!

PR rtl-optimization/85645
* shrink-wrap.c (spread_components): Return a boolean saying if
anything was changed.
(try_shrink_wrapping_separate): Iterate spread_components until
nothing changes anymore.

From-SVN: r260076
gcc/ChangeLog
gcc/shrink-wrap.c
This page took 0.051593 seconds and 5 git commands to generate.