Don't assign a new stack slot if the pre-alloc splitter already assigned one.
authorOwen Anderson <resistor@mac.com>
Thu, 26 Mar 2009 18:53:38 +0000 (18:53 +0000)
committerOwen Anderson <resistor@mac.com>
Thu, 26 Mar 2009 18:53:38 +0000 (18:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67764 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveIntervalAnalysis.cpp

index cd6f81c6eb232e8a8a785ba3a1f1f36a98c606ba..8c7fa1b1ac22f5a611d4feba8a7491aa0b2bd966 100644 (file)
@@ -1973,8 +1973,15 @@ addIntervalsForSpills(const LiveInterval &li,
   }
 
   // One stack slot per live interval.
-  if (NeedStackSlot && vrm.getPreSplitReg(li.reg) == 0)
-    Slot = vrm.assignVirt2StackSlot(li.reg);
+  if (NeedStackSlot && vrm.getPreSplitReg(li.reg) == 0) {
+    if (vrm.getStackSlot(li.reg) == VirtRegMap::NO_STACK_SLOT)
+      Slot = vrm.assignVirt2StackSlot(li.reg);
+    
+    // This case only occurs when the prealloc splitter has already assigned
+    // a stack slot to this vreg.
+    else
+      Slot = vrm.getStackSlot(li.reg);
+  }
 
   // Create new intervals and rewrite defs and uses.
   for (LiveInterval::Ranges::const_iterator