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

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 01:08:45 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 7cd7b9533c7786a76bb3ce14b3f5e29c378f28f2 f19a5abb54da2dcb1de506e7fa4a0d88a210c3dd -- llvm/include/llvm/CodeGen/LiveIntervals.h llvm/lib/CodeGen/LiveIntervals.cpp llvm/lib/CodeGen/MachineBasicBlock.cpp llvm/lib/CodeGen/PHIElimination.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp
index df4dae11f4d1..20189284c5c5 100644
--- a/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/llvm/lib/CodeGen/PHIElimination.cpp
@@ -405,14 +405,15 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
 
     SlotIndex NewStart = DestCopyIndex.getRegSlot();
 
-    SmallVector<LiveRange*> ToUpdate;
+    SmallVector<LiveRange *> ToUpdate;
     ToUpdate.push_back(&DestLI);
     for (auto &SR : DestLI.subranges())
       ToUpdate.push_back(&SR);
 
     for (auto LR : ToUpdate) {
       auto DestSegment = LR->find(MBBStartIndex);
-      assert(DestSegment != LR->end() && "PHI destination must be live in block");
+      assert(DestSegment != LR->end() &&
+             "PHI destination must be live in block");
 
       if (LR->endIndex().isDead()) {
         // A dead PHI's live range begins and ends at the start of the MBB, but
@@ -432,8 +433,8 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
         // the copy.
         VNInfo *VNI = LR->getVNInfoAt(DestSegment->start);
         assert(VNI && "value should be defined for known segment");
-        LR->addSegment(LiveInterval::Segment(
-            NewStart, DestSegment->start, VNI));
+        LR->addSegment(
+            LiveInterval::Segment(NewStart, DestSegment->start, VNI));
       } else if (DestSegment->start < NewStart) {
         // Otherwise, remove the region from the beginning of MBB to the copy
         // instruction from DestReg's live interval.
@@ -640,7 +641,7 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
                               LIS->getMBBEndIdx(&opBlock));
           for (auto &SR : SrcLI.subranges()) {
             SR.removeSegment(LastUseIndex.getRegSlot(),
-                                LIS->getMBBEndIdx(&opBlock));
+                             LIS->getMBBEndIdx(&opBlock));
           }
         }
       }

``````````

</details>


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


More information about the llvm-commits mailing list