Fixes to r153903. Added missing explanation of behaviour when the VirtRegMap is...
authorPete Cooper <peter_cooper@apple.com>
Tue, 3 Apr 2012 00:28:46 +0000 (00:28 +0000)
committerPete Cooper <peter_cooper@apple.com>
Tue, 3 Apr 2012 00:28:46 +0000 (00:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153914 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/LiveRangeEdit.h
lib/CodeGen/LiveRangeEdit.cpp

index 909130ff6179582a8b6752447a922a29b65ae42d..57a619389fa53b6197fb1beb33791dfa340a0bf0 100644 (file)
@@ -94,6 +94,11 @@ public:
   /// @param parent The register being spilled or split.
   /// @param newRegs List to receive any new registers created. This needn't be
   ///                empty initially, any existing registers are ignored.
+  /// @param MF The MachineFunction the live range edit is taking place in.
+  /// @param lis The collection of all live intervals in this function.
+  /// @param vrm Map of virtual registers to physical registers for this
+  ///            function.  If NULL, no virtual register map updates will
+  ///            be done.  This could be the case if called before Regalloc.
   LiveRangeEdit(LiveInterval &parent,
                 SmallVectorImpl<LiveInterval*> &newRegs,
                 MachineFunction &MF,
index 52e366cb7d4634897d757356dcf859dc0156da4b..4ecb2d9a60a45ffab46ae457ac258cc795c8a49f 100644 (file)
@@ -33,8 +33,10 @@ void LiveRangeEdit::Delegate::anchor() { }
 
 LiveInterval &LiveRangeEdit::createFrom(unsigned OldReg) {
   unsigned VReg = MRI.createVirtualRegister(MRI.getRegClass(OldReg));
-  VRM->grow();
-  VRM->setIsSplitFromReg(VReg, VRM->getOriginal(OldReg));
+  if (VRM) {
+    VRM->grow();
+    VRM->setIsSplitFromReg(VReg, VRM->getOriginal(OldReg));
+  }
   LiveInterval &LI = LIS.getOrCreateInterval(VReg);
   newRegs_.push_back(&LI);
   return LI;
@@ -270,8 +272,6 @@ void LiveRangeEdit::eliminateDeadDefs(SmallVectorImpl<MachineInstr*> &Dead,
       delegate_->LRE_WillShrinkVirtReg(LI->reg);
     if (!LIS.shrinkToUses(LI, &Dead))
       continue;
-    if (!VRM)
-      continue;
     
     // Don't create new intervals for a register being spilled.
     // The new intervals would have to be spilled anyway so its not worth it.
@@ -295,7 +295,7 @@ void LiveRangeEdit::eliminateDeadDefs(SmallVectorImpl<MachineInstr*> &Dead,
     if (NumComp <= 1)
       continue;
     ++NumFracRanges;
-    bool IsOriginal = VRM->getOriginal(LI->reg) == LI->reg;
+    bool IsOriginal = VRM && VRM->getOriginal(LI->reg) == LI->reg;
     DEBUG(dbgs() << NumComp << " components: " << *LI << '\n');
     SmallVector<LiveInterval*, 8> Dups(1, LI);
     for (unsigned i = 1; i != NumComp; ++i) {