[llvm-commits] [llvm] r63293 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
Owen Anderson
resistor at mac.com
Thu Jan 29 00:22:06 PST 2009
Author: resistor
Date: Thu Jan 29 02:22:06 2009
New Revision: 63293
URL: http://llvm.org/viewvc/llvm-project?rev=63293&view=rev
Log:
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!
Modified:
llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=63293&r1=63292&r2=63293&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original)
+++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Thu Jan 29 02:22:06 2009
@@ -277,7 +277,7 @@
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 @@
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 @@
LIs->RemoveMachineInstrFromMaps(DefMI);
(*LI)->removeValNo(CurrVN);
DefMI->eraseFromParent();
+ VNUseCount.erase(CurrVN);
NumDeadSpills++;
changed = true;
continue;
@@ -1176,11 +1178,15 @@
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 @@
(*UI)->eraseFromParent();
}
+ VNUseCount.erase(CurrVN);
+
LIs->RemoveMachineInstrFromMaps(DefMI);
(*LI)->removeValNo(CurrVN);
DefMI->eraseFromParent();
More information about the llvm-commits
mailing list