aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-08-06 18:35:45 +0000
committerOwen Anderson <resistor@mac.com>2008-08-06 18:35:45 +0000
commit788d04152a132121dfc04e63382c1e87e7b9607f (patch)
treea759f57491b2686f6bd892d1e044ef807622ddd6 /lib/CodeGen/LiveIntervalAnalysis.cpp
parent8a1510d19228f3cb1a847c21fa9e678a565247f7 (diff)
Only remap each VNInfo once when doing renumbering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54420 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index fba4416666..66bcf61167 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -64,8 +64,6 @@ void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LiveVariables>();
AU.addPreservedID(MachineLoopInfoID);
AU.addPreservedID(MachineDominatorsID);
- AU.addPreservedID(PHIEliminationID);
- AU.addRequiredID(PHIEliminationID);
AU.addRequiredID(TwoAddressInstructionPassID);
MachineFunctionPass::getAnalysisUsage(AU);
}
@@ -129,7 +127,7 @@ void LiveIntervals::computeNumbering() {
std::sort(Idx2MBBMap.begin(), Idx2MBBMap.end(), Idx2MBBCompare());
if (!OldI2MI.empty())
- for (iterator OI = begin(), OE = end(); OI != OE; ++OI)
+ for (iterator OI = begin(), OE = end(); OI != OE; ++OI) {
for (LiveInterval::iterator LI = OI->second.begin(),
LE = OI->second.end(); LI != LE; ++LI) {
@@ -172,15 +170,18 @@ void LiveIntervals::computeNumbering() {
else
LI->end = InstrSlots::NUM * i2miMap_.size();
}
+ }
+
+ for (LiveInterval::vni_iterator VNI = OI->second.vni_begin(),
+ VNE = OI->second.vni_end(); VNI != VNE; ++VNI) {
+ VNInfo* vni = *VNI;
// Remap the VNInfo def index, which works the same as the
- // start indices above.
- VNInfo* vni = LI->valno;
-
- // VN's with special sentinel defs don't need to be remapped.
+ // start indices above. VN's with special sentinel defs
+ // don't need to be remapped.
if (vni->def != ~0U && vni->def != ~1U) {
- index = vni->def / InstrSlots::NUM;
- offset = vni->def % InstrSlots::NUM;
+ unsigned index = vni->def / InstrSlots::NUM;
+ unsigned offset = vni->def % InstrSlots::NUM;
if (offset == InstrSlots::LOAD) {
std::vector<IdxMBBPair>::const_iterator I =
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), vni->def);
@@ -200,14 +201,14 @@ void LiveIntervals::computeNumbering() {
// PHI kills don't need to be remapped.
if (!vni->kills[i]) continue;
- index = (vni->kills[i]-1) / InstrSlots::NUM;
- offset = vni->kills[i] % InstrSlots::NUM;
- if (offset == InstrSlots::LOAD) {
+ unsigned index = (vni->kills[i]-1) / InstrSlots::NUM;
+ unsigned offset = vni->kills[i] % InstrSlots::NUM;
+ if (offset == InstrSlots::STORE) {
std::vector<IdxMBBPair>::const_iterator I =
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), vni->kills[i]);
--I;
- vni->kills[i] = getMBBEndIdx(I->second) + 1;
+ vni->kills[i] = getMBBEndIdx(I->second);
} else {
unsigned idx = index;
while (index < OldI2MI.size() && !OldI2MI[index]) ++index;
@@ -220,6 +221,7 @@ void LiveIntervals::computeNumbering() {
}
}
}
+ }
}
/// runOnMachineFunction - Register allocate the whole function