> 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!
I don't know the code much so I don't see why this solves the problem. > 2018-05-08 Segher Boessenkool <seg...@kernel.crashing.org> > > 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. OK if you add a comment in try_shrink_wrapping_separate with the rationale. -- Eric Botcazou