[llvm-commits] [llvm] r51691 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
Owen Anderson
resistor at mac.com
Thu May 29 11:15:50 PDT 2008
Author: resistor
Date: Thu May 29 13:15:49 2008
New Revision: 51691
URL: http://llvm.org/viewvc/llvm-project?rev=51691&view=rev
Log:
Renumbering needs to account for instruction slot offsets when performing lookups in the index maps.
Modified:
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=51691&r1=51690&r2=51691&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Thu May 29 13:15:49 2008
@@ -58,8 +58,6 @@
AU.addRequired<LiveVariables>();
AU.addPreservedID(MachineLoopInfoID);
AU.addPreservedID(MachineDominatorsID);
- AU.addPreservedID(PHIEliminationID);
- AU.addRequiredID(PHIEliminationID);
AU.addRequiredID(TwoAddressInstructionPassID);
MachineFunctionPass::getAnalysisUsage(AU);
}
@@ -75,6 +73,8 @@
delete ClonedMIs[i];
}
+#include <iostream>
+
void LiveIntervals::computeNumbering() {
Index2MiMap OldI2MI = i2miMap_;
@@ -112,14 +112,27 @@
for (iterator I = begin(), E = end(); I != E; ++I)
for (LiveInterval::iterator LI = I->second.begin(), LE = I->second.end();
LI != LE; ++LI) {
- LI->start = mi2iMap_[OldI2MI[LI->start]];
- LI->end = mi2iMap_[OldI2MI[LI->end]];
+ unsigned offset = LI->start % InstrSlots::NUM;
+ LI->start = mi2iMap_[OldI2MI[LI->start / InstrSlots::NUM]] + offset;
+
+ if (LI->end / InstrSlots::NUM < OldI2MI.size()) {
+ // FIXME: Not correct when the instruction at LI->end has
+ // been removed
+ offset = LI->end % InstrSlots::NUM;
+ LI->end = mi2iMap_[OldI2MI[LI->end / InstrSlots::NUM]] + offset;
+ } else {
+ LI->end = i2miMap_.size() * InstrSlots::NUM;
+ }
VNInfo* vni = LI->valno;
- vni->def = mi2iMap_[OldI2MI[vni->def]];
+ offset = vni->def % InstrSlots::NUM;
+ vni->def = mi2iMap_[OldI2MI[vni->def / InstrSlots::NUM]] + offset;
- for (size_t i = 0; i < vni->kills.size(); ++i)
- vni->kills[i] = mi2iMap_[OldI2MI[vni->kills[i]]];
+ for (size_t i = 0; i < vni->kills.size(); ++i) {
+ offset = vni->kills[i] % InstrSlots::NUM;
+ vni->kills[i] = mi2iMap_[OldI2MI[vni->kills[i] / InstrSlots::NUM]] +
+ offset;
+ }
}
}
More information about the llvm-commits
mailing list