Improved PHI def marking, replaced some gotos with breaks.
authorLang Hames <lhames@gmail.com>
Thu, 18 Jun 2009 22:01:47 +0000 (22:01 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 18 Jun 2009 22:01:47 +0000 (22:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73727 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveIntervalAnalysis.cpp

index b67e39d2a025cd645aff7d0f13e43a3d471e4dc1..d4169dbcf51d3cb5a2e26d08f36afce885a61cc9 100644 (file)
@@ -584,7 +584,7 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
 
         // Replace the interval with one of a NEW value number.  Note that this
         // value number isn't actually defined by an instruction, weird huh? :)
-        LiveRange LR(Start, End, interval.getNextValue(0, 0, false, VNInfoAllocator));
+        LiveRange LR(Start, End, interval.getNextValue(Start, 0, false, VNInfoAllocator));
         LR.valno->setIsPHIDef(true);
         DOUT << " replace range with " << LR;
         interval.addRange(LR);
@@ -753,7 +753,7 @@ void LiveIntervals::handleLiveInRegister(MachineBasicBlock *MBB,
       DOUT << " killed";
       end = getUseIndex(baseIndex) + 1;
       SeenDefUse = true;
-      goto exit;
+      break;
     } else if (mi->modifiesRegister(interval.reg, tri_)) {
       // Another instruction redefines the register before it is ever read.
       // Then the register is essentially dead at the instruction that defines
@@ -762,7 +762,7 @@ void LiveIntervals::handleLiveInRegister(MachineBasicBlock *MBB,
       DOUT << " dead";
       end = getDefIndex(start) + 1;
       SeenDefUse = true;
-      goto exit;
+      break;
     }
 
     baseIndex += InstrSlots::NUM;
@@ -774,7 +774,6 @@ void LiveIntervals::handleLiveInRegister(MachineBasicBlock *MBB,
     }
   }
 
-exit:
   // Live-in register might not be used at all.
   if (!SeenDefUse) {
     if (isAlias) {
@@ -786,7 +785,10 @@ exit:
     }
   }
 
-  LiveRange LR(start, end, interval.getNextValue(0, 0, false, VNInfoAllocator));
+  VNInfo *vni = interval.getNextValue(start, 0, false, VNInfoAllocator);
+  vni->setIsPHIDef(true);
+  LiveRange LR(start, end, vni);
+  
   interval.addRange(LR);
   interval.addKill(LR.valno, end);
   DOUT << " +" << LR << '\n';