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