[llvm-branch-commits] [Support] Use block numbers for LoopInfo BBMap (PR #103400)
Alexis Engelke via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Aug 13 12:38:16 PDT 2024
https://github.com/aengelke created https://github.com/llvm/llvm-project/pull/103400
Replace the DenseMap from blocks to their innermost loop a vector
indexed by block numbers, when possible.
This requires updating the loop info when blocks are renumbered. This
update is currently implemented by iterating over all loops and their
blocks, as there is no mapping from the previous block number to the
block (as opposed to the dominator tree). This makes the update O(n^2)
in the worst case: a block in a loop with nesting level x will be
considered x times to determine the innermost loop. In practice, it
should be acceptable, though (but probably not in the long run, O(n^2)
algorithms are generally bad).
NB: I'm generally not happy with the way loops are stored. As I think
that there's room for improvement, I don't want to touch the
representation at this point.
I'm also considering to remove the number updating facility in favor of
recomputing the analysis, it natural loop analysis isn't that expensive
and it might give more freedom for data structure design to have a fixed
numbering without needing to worry about numbering changes.
More information about the llvm-branch-commits
mailing list