[llvm] [NFC] Refactor looping over recomputeLiveIns into function (PR #88040)
Momchil Velikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 01:40:14 PDT 2024
momchil-velikov wrote:
> My understanding is that the live-ins computation for the basic blocks is independent of each other.
Live-ins are computed by backward data-flow analysis, thus live-ins of a block depend on the live-outs of the block, which
in turn depend on the live-ins of the successor blocks.
> If this is correct, then the loop could be formulated as follows, which avoids unnecessary calls.
> ```
> static inline void
> fullyRecomputeLiveIns(ArrayRef<MachineBasicBlock *> MBBs) {
> for (MachineBasicBlock *MBB : MBBs)
> while (recomputeLiveIns(*MBB))
> /* intentionally empty/* ;
> }
> ```
That's what I expect to result in unnecessary calls since once you've computed live-ins for a block, immediately (i.e. without touching a different block) re-computing them for the same block would result in no change (50% waste), except when the block loops into itself, in which case only you get "only" 33.3% waste.
> Also, is the function `recomputeLiveIns` in the current form needed? I see no callers to it, so both functions could be integrated into one.
I would suggest to leave it alone, so one can control independently the computation on a block and the order in which those computations are performed (even though DFS order is universally preferred).
https://github.com/llvm/llvm-project/pull/88040
More information about the llvm-commits
mailing list