[llvm] CodeGen: Trim each PHI source subregister lane at its own last read (PR #226209)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 11:56:21 PDT 2026


================
@@ -766,13 +795,35 @@ void PHIEliminationImpl::LowerPHINode(MachineBasicBlock &MBB,
                  "Cannot find kill instruction");
 
           SlotIndex LastUseIndex = LIS->getInstructionIndex(*KillInst);
-          SrcLI.removeSegment(LastUseIndex.getRegSlot(),
-                              LIS->getMBBEndIdx(&opBlock));
-          for (auto &SR : SrcLI.subranges()) {
-            SR.removeSegment(LastUseIndex.getRegSlot(),
-                             LIS->getMBBEndIdx(&opBlock));
+          SlotIndex BlockEndIndex = LIS->getMBBEndIdx(&opBlock);
----------------
jayfoad wrote:

Agreed, this does look like a restricted form of shrinkToUses. #228073 is the simpler alternative that just calls shrinkToUses.

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


More information about the llvm-commits mailing list