[llvm] [PHIElimination] Handle subranges in LiveInterval updates (PR #69429)

Carl Ritson via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 22:07:33 PDT 2023


================
@@ -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);
----------------
perlfu wrote:

I have changed removeSegment to accept these.
I cannot see any obvious reason why it should not, perhaps only to avoid other coding errors?

https://github.com/llvm/llvm-project/pull/69429


More information about the llvm-commits mailing list