aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorCarl Ritson <carl.ritson@amd.com>2023-11-13 12:16:26 +0900
committerGitHub <noreply@github.com>2023-11-13 12:16:26 +0900
commit52b247b1d342ac84dc15b1dc67dec66f93a1d18e (patch)
tree08a78174631ef61bd8820f2f9cc809a633438a10 /llvm/lib/CodeGen/MachineBasicBlock.cpp
parent18415c8365047841c4671798e0129ca9bbd03c40 (diff)
downloadllvm-52b247b1d342ac84dc15b1dc67dec66f93a1d18e.zip
llvm-52b247b1d342ac84dc15b1dc67dec66f93a1d18e.tar.gz
llvm-52b247b1d342ac84dc15b1dc67dec66f93a1d18e.tar.bz2
[PHIElimination] Handle subranges in LiveInterval updates (#69429)
Add subrange tracking and handling for LiveIntervals during PHI elimination. This requires extending MachineBasicBlock::SplitCriticalEdge to also update subrange intervals.
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index ef8e1bd..d9e2268 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -1283,6 +1283,8 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
assert(VNI &&
"PHI sources should be live out of their predecessors.");
LI.addSegment(LiveInterval::Segment(StartIndex, EndIndex, VNI));
+ for (auto &SR : LI.subranges())
+ SR.addSegment(LiveInterval::Segment(StartIndex, EndIndex, VNI));
}
}
}
@@ -1302,8 +1304,16 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
VNInfo *VNI = LI.getVNInfoAt(PrevIndex);
assert(VNI && "LiveInterval should have VNInfo where it is live.");
LI.addSegment(LiveInterval::Segment(StartIndex, EndIndex, VNI));
+ // Update subranges with live values
+ for (auto &SR : LI.subranges()) {
+ VNInfo *VNI = SR.getVNInfoAt(PrevIndex);
+ if (VNI)
+ SR.addSegment(LiveInterval::Segment(StartIndex, EndIndex, VNI));
+ }
} else if (!isLiveOut && !isLastMBB) {
LI.removeSegment(StartIndex, EndIndex);
+ for (auto &SR : LI.subranges())
+ SR.removeSegment(StartIndex, EndIndex);
}
}