projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make this const.
[oota-llvm.git]
/
lib
/
CodeGen
/
TwoAddressInstructionPass.cpp
diff --git
a/lib/CodeGen/TwoAddressInstructionPass.cpp
b/lib/CodeGen/TwoAddressInstructionPass.cpp
index e37639e068a680ad123904fb65e0ab413cb4454e..3c404046f15e49e875ccde2756fb780bd8b33bce 100644
(file)
--- a/
lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/
lib/CodeGen/TwoAddressInstructionPass.cpp
@@
-316,7
+316,7
@@
bool TwoAddressInstructionPass::NoUseAfterLastDef(unsigned Reg,
MachineInstr *TwoAddressInstructionPass::FindLastUseInMBB(unsigned Reg,
MachineBasicBlock *MBB,
unsigned Dist) {
MachineInstr *TwoAddressInstructionPass::FindLastUseInMBB(unsigned Reg,
MachineBasicBlock *MBB,
unsigned Dist) {
- unsigned LastUseDist =
Dist
;
+ unsigned LastUseDist =
0
;
MachineInstr *LastUse = 0;
for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(Reg),
E = MRI->reg_end(); I != E; ++I) {
MachineInstr *LastUse = 0;
for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(Reg),
E = MRI->reg_end(); I != E; ++I) {
@@
-327,7
+327,10
@@
MachineInstr *TwoAddressInstructionPass::FindLastUseInMBB(unsigned Reg,
DenseMap<MachineInstr*, unsigned>::iterator DI = DistanceMap.find(MI);
if (DI == DistanceMap.end())
continue;
DenseMap<MachineInstr*, unsigned>::iterator DI = DistanceMap.find(MI);
if (DI == DistanceMap.end())
continue;
- if (MO.isUse() && DI->second < LastUseDist) {
+ if (DI->second >= Dist)
+ continue;
+
+ if (MO.isUse() && DI->second > LastUseDist) {
LastUse = DI->first;
LastUseDist = DI->second;
}
LastUse = DI->first;
LastUseDist = DI->second;
}
@@
-858,6
+861,12
@@
bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
}
}
}
}
}
}
+
+ // We're really going to nuke the old inst. If regB was marked
+ // as a kill we need to update its Kills list.
+ if (mi->getOperand(si).isKill())
+ LV->removeVirtualRegisterKilled(regB, mi);
+
mbbi->erase(mi); // Nuke the old inst.
mi = nmi;
++NumDeletes;
mbbi->erase(mi); // Nuke the old inst.
mi = nmi;
++NumDeletes;
@@
-946,11
+955,6
@@
bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
// Update live variables for regB.
if (LV) {
// Update live variables for regB.
if (LV) {
- LiveVariables::VarInfo& varInfoB = LV->getVarInfo(regB);
-
- // regB is used in this BB.
- varInfoB.UsedBlocks[mbbi->getNumber()] = true;
-
if (LV->removeVirtualRegisterKilled(regB, mi))
LV->addVirtualRegisterKilled(regB, prevMI);
if (LV->removeVirtualRegisterKilled(regB, mi))
LV->addVirtualRegisterKilled(regB, prevMI);