https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77498
--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> --- On Mon, 20 Mar 2017, thopre01 at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77498 > > --- Comment #9 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> --- > Sadly I could not come up with a minimal testcase so far. What I can see from > the code is that tree code hoisting increases the live range of some values > which then translates into more spilling in reload. > > As an approximation I'm wondering if the maximum distance (computer in number > of blocks traversed) from the definition to the use could be used to limit > when > the optimization is applied when optimizing for speed. Sadly the data-flow used to compute the opportunities is not suitable for determining this. It would probaly require "aging" of exprs in the hoistable sets when propagating the dataflow for ANTIC_IN (in principle PRE would have a similar issue). We already restrict "distance" by requiring at least one successor of the hoisting point to provide the value directly but we do not limit proximity further. See do_hoist_insertion.