diff options
| author | Owen Anderson <resistor@mac.com> | 2009-01-29 08:22:06 +0000 | 
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2009-01-29 08:22:06 +0000 | 
| commit | c0924a0632c842e18cf089172cf9ca7aadc96d5a (patch) | |
| tree | 3e9d1f1609633e7230611db462fc8e75cede6f4b | |
| parent | 17aa9415347445e54294d961ed4480ccae38d9dd (diff) | |
| download | bcm5719-llvm-c0924a0632c842e18cf089172cf9ca7aadc96d5a.tar.gz bcm5719-llvm-c0924a0632c842e18cf089172cf9ca7aadc96d5a.zip | |
Fix an issue where restores could be inserted after a terminator instruction,
and an iterator invalidation issue.
FreeBench/pifft no longer miscompiles with these fixes!
llvm-svn: 63293
| -rw-r--r-- | llvm/lib/CodeGen/PreAllocSplitting.cpp | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/llvm/lib/CodeGen/PreAllocSplitting.cpp b/llvm/lib/CodeGen/PreAllocSplitting.cpp index 44819aabbab..4dc8b82972a 100644 --- a/llvm/lib/CodeGen/PreAllocSplitting.cpp +++ b/llvm/lib/CodeGen/PreAllocSplitting.cpp @@ -277,7 +277,7 @@ PreAllocSplitting::findRestorePoint(MachineBasicBlock *MBB, MachineInstr *MI,      MII = ++MII;      // FIXME: Limit the number of instructions to examine to reduce      // compile time? -    while (MII != MBB->end()) { +    while (MII != MBB->getFirstTerminator()) {        unsigned Index = LIs->getInstructionIndex(MII);        if (Index > LastIdx)          break; @@ -486,7 +486,8 @@ VNInfo* PreAllocSplitting::PerformPHIConstruction(             IncomingVNs.begin(), E = IncomingVNs.end(); I != E; ++I) {          I->second->hasPHIKill = true;          unsigned KillIndex = LIs->getMBBEndIdx(I->first); -        LI->addKill(I->second, KillIndex); +        if (!LiveInterval::isKill(I->second, KillIndex)) +          LI->addKill(I->second, KillIndex);        }        unsigned EndIndex = 0; @@ -1118,6 +1119,7 @@ bool PreAllocSplitting::removeDeadSpills(SmallPtrSet<LiveInterval*, 8>& split) {          LIs->RemoveMachineInstrFromMaps(DefMI);          (*LI)->removeValNo(CurrVN);          DefMI->eraseFromParent(); +        VNUseCount.erase(CurrVN);          NumDeadSpills++;          changed = true;          continue; @@ -1176,11 +1178,15 @@ bool PreAllocSplitting::removeDeadSpills(SmallPtrSet<LiveInterval*, 8>& split) {               VNUseCount[CurrVN].begin(), IE = VNUseCount[CurrVN].end();               II != IE; ++II) {            for (DenseMap<VNInfo*, SmallPtrSet<MachineInstr*, 4> >::iterator -               VI = VNUseCount.begin(), VE = VNUseCount.end(); VI != VE; ++VI) -            VI->second.erase(*II); +               VNI = VNUseCount.begin(), VNE = VNUseCount.end(); VNI != VNE;  +               ++VNI) +            if (VNI->first != CurrVN) +              VNI->second.erase(*II);            LIs->RemoveMachineInstrFromMaps(*II);            (*II)->eraseFromParent();          } +         +        VNUseCount.erase(CurrVN);          for (DenseMap<VNInfo*, SmallPtrSet<MachineInstr*, 4> >::iterator               VI = VNUseCount.begin(), VE = VNUseCount.end(); VI != VE; ++VI) @@ -1204,6 +1210,8 @@ bool PreAllocSplitting::removeDeadSpills(SmallPtrSet<LiveInterval*, 8>& split) {          (*UI)->eraseFromParent();        } +      VNUseCount.erase(CurrVN); +                LIs->RemoveMachineInstrFromMaps(DefMI);        (*LI)->removeValNo(CurrVN);        DefMI->eraseFromParent(); | 

