WIP WIP WIP
This patch is an attempt to build SCEVs iteratively rather than
recursively. It resolves stack overflow issues when trying to construct
SCEVs for certain inputs, e.g. PR45201.
The basic approach is to to use a worklist to queue operands of V which
need to be created before V. To do so, the current patch adds a
getOperandsToCreate function which collects the operands SCEV
construction depends on for a given value. This is a slight duplication
At the moment, there are still a few things that are not handled, e.g.
non-simple AddRec phis, but there are only very few test failures
already. My plan is to first get down to zero test failures and move to
perf tuning from there. Any high-level thoughts and suggestions would be
Compile-time impact at the moment is a ~0.28% geomean regression on the
Note those numbers are D114260/D114633.
One notable change/complication is that getBackedgeTakenInfo may
remove/forget expressions while iteratively constructing SCEVs. So in
some cases, a SCEV we constructed earlier will get removed before it is
used be one of the next iterations.
Fixes #44546, #49599