diff options
author | Kai Nacke <kai.peter.nacke@ibm.com> | 2024-04-15 17:12:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-15 17:12:25 -0400 |
commit | 21d177096f84c38cf434c21bd3ff0dbd2ca163d0 (patch) | |
tree | be2960269708f44415bd0bcbea0cca863e73590d /llvm/lib/CodeGen/BranchFolding.cpp | |
parent | a855eea7fe86ef09a87f6251b3b711b821ae32bf (diff) | |
download | llvm-21d177096f84c38cf434c21bd3ff0dbd2ca163d0.zip llvm-21d177096f84c38cf434c21bd3ff0dbd2ca163d0.tar.gz llvm-21d177096f84c38cf434c21bd3ff0dbd2ca163d0.tar.bz2 |
[NFC] Refactor looping over recomputeLiveIns into function (#88040)
https://github.com/llvm/llvm-project/pull/79940 put calls to
recomputeLiveIns into
a loop, to repeatedly call the function until the computation converges.
However,
this repeats a lot of code. This changes moves the loop into a function
to simplify
the handling.
Note that this changes the order in which recomputeLiveIns is called.
For example,
```
bool anyChange = false;
do {
anyChange = recomputeLiveIns(*ExitMBB) || recomputeLiveIns(*LoopMBB);
} while (anyChange);
```
only begins to recompute the live-ins for LoopMBB after the computation
for ExitMBB
has converged. With this change, all basic blocks have a recomputation
of the live-ins
for each loop iteration. This can result in less or more calls,
depending on the
situation.
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index ecf7bc3..55aa1d4 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -2047,12 +2047,8 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) { MBB->splice(Loc, TBB, TBB->begin(), TIB); FBB->erase(FBB->begin(), FIB); - if (UpdateLiveIns) { - bool anyChange = false; - do { - anyChange = recomputeLiveIns(*TBB) || recomputeLiveIns(*FBB); - } while (anyChange); - } + if (UpdateLiveIns) + fullyRecomputeLiveIns({TBB, FBB}); ++NumHoist; return true; |