summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-11-16 03:05:12 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-11-16 03:05:12 +0000
commit9ddd69a8bc46a2ccf9373c88b203aed2828200fd (patch)
treeab3593d3d94b65e53aec4e863d631963a4495007 /llvm/lib/CodeGen
parente6270395e33776e640a1eeeeda778f2b59234dc8 (diff)
downloadbcm5719-llvm-9ddd69a8bc46a2ccf9373c88b203aed2828200fd.tar.gz
bcm5719-llvm-9ddd69a8bc46a2ccf9373c88b203aed2828200fd.zip
Process all uses first before defs to accurately capture register liveness. rdar://10449480
llvm-svn: 144770
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/TwoAddressInstructionPass.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index e2fd0076cd3..2e5111dee56 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1115,6 +1115,7 @@ TwoAddressInstructionPass::RescheduleKillAboveMI(MachineBasicBlock *MBB,
MCID.isTerminator())
// Don't move pass calls, etc.
return false;
+ SmallVector<unsigned, 2> OtherDefs;
for (unsigned i = 0, e = OtherMI->getNumOperands(); i != e; ++i) {
const MachineOperand &MO = OtherMI->getOperand(i);
if (!MO.isReg())
@@ -1131,15 +1132,20 @@ TwoAddressInstructionPass::RescheduleKillAboveMI(MachineBasicBlock *MBB,
// Don't want to extend other live ranges and update kills.
return false;
} else {
- if (Uses.count(MOReg))
- return false;
- if (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
- LiveDefs.count(MOReg))
- return false;
- // Physical register def is seen.
- Defs.erase(MOReg);
+ OtherDefs.push_back(MOReg);
}
}
+
+ for (unsigned i = 0, e = OtherDefs.size(); i != e; ++i) {
+ unsigned MOReg = OtherDefs[i];
+ if (Uses.count(MOReg))
+ return false;
+ if (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
+ LiveDefs.count(MOReg))
+ return false;
+ // Physical register def is seen.
+ Defs.erase(MOReg);
+ }
}
// Move the old kill above MI, don't forget to move debug info as well.
OpenPOWER on IntegriCloud