aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorOskar Wirga <10386631+oskarwirga@users.noreply.github.com>2024-01-30 19:33:04 -0800
committerGitHub <noreply@github.com>2024-01-30 19:33:04 -0800
commitff4636a4ab00b633c15eb3942c26126ceb2662e6 (patch)
treeb1045350e6a7f534445a80530392cce68c7eaaba /llvm/lib/CodeGen/BranchFolding.cpp
parentc43fda3efcbf5b16e611473cf03c88381237f50f (diff)
downloadllvm-ff4636a4ab00b633c15eb3942c26126ceb2662e6.zip
llvm-ff4636a4ab00b633c15eb3942c26126ceb2662e6.tar.gz
llvm-ff4636a4ab00b633c15eb3942c26126ceb2662e6.tar.bz2
Refactor recomputeLiveIns to converge on added MachineBasicBlocks (#79940)
This is a fix for the regression seen in https://github.com/llvm/llvm-project/pull/79498 > Currently, the way that recomputeLiveIns works is that it will recompute the livein registers for that MachineBasicBlock but it matters what order you call recomputeLiveIn which can result in incorrect register allocations down the line. Now we do not recompute the entire CFG but we do ensure that the newly added MBB do reach convergence.
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index a9f7835..ecf7bc3 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -2048,8 +2048,10 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) {
FBB->erase(FBB->begin(), FIB);
if (UpdateLiveIns) {
- recomputeLiveIns(*TBB);
- recomputeLiveIns(*FBB);
+ bool anyChange = false;
+ do {
+ anyChange = recomputeLiveIns(*TBB) || recomputeLiveIns(*FBB);
+ } while (anyChange);
}
++NumHoist;