More two-address fixes. This gets lua working with join-creation enabled.
authorOwen Anderson <resistor@mac.com>
Mon, 12 Jan 2009 03:10:40 +0000 (03:10 +0000)
committerOwen Anderson <resistor@mac.com>
Mon, 12 Jan 2009 03:10:40 +0000 (03:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62073 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/PreAllocSplitting.cpp

index 5a2948b852b1e59513d74e25853d151705faa407..2f49e2511526ba1ff02d051fbd971883a87102ac 100644 (file)
@@ -639,6 +639,8 @@ VNInfo* PreAllocSplitting::PerformPHIConstruction(
         EndIndex = LIs->getMBBEndIdx(MBB);
       
       LI->addRange(LiveRange(StartIndex, EndIndex+1, ret));
+      if (intrablock)
+        LI->addKill(ret, EndIndex);
     } else {
       Phis[MBB] = ret = LI->getNextValue(~0U, /*FIXME*/ 0,
                                           LIs->getVNInfoAllocator());
@@ -673,6 +675,8 @@ VNInfo* PreAllocSplitting::PerformPHIConstruction(
       } else
         EndIndex = LIs->getMBBEndIdx(MBB);
       LI->addRange(LiveRange(StartIndex, EndIndex+1, ret));
+      if (intrablock)
+        LI->addKill(ret, EndIndex);
     }
   } else if (ContainsDefs && !ContainsUses) {
     SmallPtrSet<MachineInstr*, 2>& BlockDefs = Defs[MBB];
@@ -808,7 +812,8 @@ VNInfo* PreAllocSplitting::PerformPHIConstruction(
   // Memoize results so we don't have to recompute them.
   if (!intrablock) LiveOut[MBB] = ret;
   else {
-    NewVNs[use] = ret;
+    if (!NewVNs.count(use))
+      NewVNs[use] = ret;
     Visited.insert(use);
   }
 
@@ -1124,13 +1129,14 @@ bool PreAllocSplitting::Rematerialize(unsigned vreg, VNInfo* ValNo,
   if (KillPt->getParent() == BarrierMBB) {
     UpdateRegisterInterval(ValNo, LIs->getUseIndex(KillIdx)+1,
                            LIs->getDefIndex(RestoreIdx));
-
+    
     ++NumSplits;
     ++NumRemats;
     return true;
   }
 
   RepairLiveInterval(CurrLI, ValNo, DefMI, RestoreIdx);
+  
   ++NumSplits;
   ++NumRemats;
   return true;  
@@ -1211,10 +1217,6 @@ bool PreAllocSplitting::SplitRegLiveInterval(LiveInterval *LI) {
   MachineInstr *DefMI = (ValNo->def != ~0U)
     ? LIs->getInstructionFromIndex(ValNo->def) : NULL;
 
-  // If this would create a new join point, do not split.
-  if (DefMI && createsNewJoin(LR, DefMI->getParent(), Barrier->getParent()))
-    return false;
-
   // Find all references in the barrier mbb.
   SmallPtrSet<MachineInstr*, 4> RefsInMBB;
   for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(CurrLI->reg),
@@ -1355,6 +1357,8 @@ PreAllocSplitting::SplitRegLiveIntervals(const TargetRegisterClass **RCs) {
   while (!Intervals.empty()) {
     if (PreSplitLimit != -1 && (int)NumSplits == PreSplitLimit)
       break;
+    else if (NumSplits == 4)
+      Change |= Change;
     LiveInterval *LI = Intervals.back();
     Intervals.pop_back();
     Change |= SplitRegLiveInterval(LI);