diff options
author | Carl Ritson <carl.ritson@amd.com> | 2023-09-11 15:10:52 +0900 |
---|---|---|
committer | Carl Ritson <carl.ritson@amd.com> | 2023-09-11 17:15:09 +0900 |
commit | 3bff611068ae70e3273a46bbc72bc66b66f98c1c (patch) | |
tree | c9c7aae020cd7652024cc41387ef59cfb67d92cf /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 7ec8fd4cc749545fd74959082b5f93fdef802f6e (diff) | |
download | llvm-3bff611068ae70e3273a46bbc72bc66b66f98c1c.zip llvm-3bff611068ae70e3273a46bbc72bc66b66f98c1c.tar.gz llvm-3bff611068ae70e3273a46bbc72bc66b66f98c1c.tar.bz2 |
[PHIElimination] Handle subranges in LiveInterval updates
Add handling for subrange updates in LiveInterval preservation.
This requires extending MachineBasicBlock::SplitCriticalEdge
to also update subrange intervals.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D158144
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 280ced6..f7beb51 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -1275,6 +1275,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)); } } } @@ -1294,8 +1296,18 @@ 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()) { + if (SR.overlaps(StartIndex, EndIndex)) + SR.removeSegment(StartIndex, EndIndex); + } } } |