aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorOskar Wirga <10386631+oskarwirga@users.noreply.github.com>2024-01-26 11:25:36 -0800
committerGitHub <noreply@github.com>2024-01-26 11:25:36 -0800
commit59bf60519fc30d9d36c86abd83093b068f6b1e4b (patch)
tree0e22e6e25b8e64adcc309de01e476594e99eace7 /llvm/lib/CodeGen/BranchFolding.cpp
parent2a068507016e476893b6b1b9c55b255dbae5829e (diff)
downloadllvm-59bf60519fc30d9d36c86abd83093b068f6b1e4b.zip
llvm-59bf60519fc30d9d36c86abd83093b068f6b1e4b.tar.gz
llvm-59bf60519fc30d9d36c86abd83093b068f6b1e4b.tar.bz2
Refactor recomputeLiveIns to operate on whole CFG (#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. This PR fixes that by simply recomputing the liveins for the entire CFG until convergence is achieved. This makes it harder to introduce subtle bugs which alter liveness.
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index a9f7835..9075fa4 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -2048,8 +2048,7 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) {
FBB->erase(FBB->begin(), FIB);
if (UpdateLiveIns) {
- recomputeLiveIns(*TBB);
- recomputeLiveIns(*FBB);
+ recomputeLiveIns(*MBB->getParent());
}
++NumHoist;