[llvm] r174935 - Fix the updating of LiveIntervals after splitting a critical edge. PHI operand

Cameron Zwarich zwarich at apple.com
Mon Feb 11 19:49:17 PST 2013


Author: zwarich
Date: Mon Feb 11 21:49:17 2013
New Revision: 174935

URL: http://llvm.org/viewvc/llvm-project?rev=174935&view=rev
Log:
Fix the updating of LiveIntervals after splitting a critical edge. PHI operand
live ranges should always be extended, and the only successor that should be
considered for extension of other ranges is the target of the split edge.

Modified:
    llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp

Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=174935&r1=174934&r2=174935&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Mon Feb 11 21:49:17 2013
@@ -796,8 +796,8 @@ MachineBasicBlock::SplitCriticalEdge(Mac
           MachineOperand &MO = I->getOperand(ni);
           unsigned Reg = MO.getReg();
           PHISrcRegs.insert(Reg);
-          if (MO.isUndef() || !isLastMBB)
-            break;
+          if (MO.isUndef())
+            continue;
 
           LiveInterval &LI = LIS->getInterval(Reg);
           VNInfo *VNI = LI.getVNInfoAt(PrevIndex);
@@ -817,16 +817,7 @@ MachineBasicBlock::SplitCriticalEdge(Mac
       if (!LI.liveAt(PrevIndex))
         continue;
 
-      bool isLiveOut = false;
-      for (MachineBasicBlock::succ_iterator SI = succ_begin(),
-           SE = succ_end(); SI != SE; ++SI) {
-        MachineBasicBlock *SuccMBB = *SI == NMBB ? Succ : *SI;
-        if (LI.liveAt(LIS->getMBBStartIdx(SuccMBB))) {
-          isLiveOut = true;
-          break;
-        }
-      }
-
+      bool isLiveOut = LI.liveAt(LIS->getMBBStartIdx(Succ));
       if (isLiveOut && isLastMBB) {
         VNInfo *VNI = LI.getVNInfoAt(PrevIndex);
         assert(VNI && "LiveInterval should have VNInfo where it is live.");





More information about the llvm-commits mailing list