[llvm] (Draft) [SimplifyIndVar] Push more users to worklist for simplifyUsers (PR #93598)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 00:04:44 PDT 2024


v01dXYZ wrote:

@efriedma-quic The simplification algorithm is almost greedy forward. It stops descending as soon as there is no possible simplification. There is one big exception with instructions representing a SCEV Add Rec associated to the current analysed loop which are *always* followed, but it's restricting and the user will be traversed only during the analysis of the right loop.

The quadratic behaviour could in theory appear when a simplification is always available. One way to avoid going too far is to keep a counter when traversing the use chain which is incremented everytime we jump to a out-of-loop block and reset when we go back inside the loop. It's a fast way to compute a overapproximation of `dist(Loop, CurrentBlock)`.

I ran `test-suite` for `compile_time` but I don't see significant regressions. I would like to have some advice about performance regressions as I fear I could make a dumb mistake (a short sanity check list).

https://github.com/llvm/llvm-project/pull/93598


More information about the llvm-commits mailing list