aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2007-12-11 19:17:04 +0000
committerBill Wendling <isanbard@gmail.com>2007-12-11 19:17:04 +0000
commit28bd5f0e47d968d64ea2e64868c505923b27c24d (patch)
treecd0878161506531c1e4ed25e0f244ba62c312213
parent650b0527a495acbf7d6ee3343e8c41fae1686148 (diff)
downloadexternal_llvm-28bd5f0e47d968d64ea2e64868c505923b27c24d.zip
external_llvm-28bd5f0e47d968d64ea2e64868c505923b27c24d.tar.gz
external_llvm-28bd5f0e47d968d64ea2e64868c505923b27c24d.tar.bz2
- Update the virtual reg to machine instruction map when hoisting.
- Fix subtle bug when creating initially creating this map. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44873 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/MachineLICM.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp
index b158e90..b5a0084 100644
--- a/lib/CodeGen/MachineLICM.cpp
+++ b/lib/CodeGen/MachineLICM.cpp
@@ -215,7 +215,7 @@ void MachineLICM::MapVirtualRegisterDefs(const MachineFunction &MF) {
const MachineInstr &MI = *II;
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
- const MachineOperand &MO = MI.getOperand(0);
+ const MachineOperand &MO = MI.getOperand(i);
if (MO.isRegister() && MO.isDef() &&
MRegisterInfo::isVirtualRegister(MO.getReg()))
@@ -317,7 +317,17 @@ void MachineLICM::Hoist(MachineInstr &MI) {
"The predecessor doesn't feed directly into the loop header!");
// Now move the instructions to the predecessor.
- MoveInstToEndOfBlock(MBB, MI.clone());
+ MachineInstr *NewMI = MI.clone();
+ MoveInstToEndOfBlock(MBB, NewMI);
+
+ // Update VRegDefs.
+ for (unsigned i = 0, e = NewMI->getNumOperands(); i != e; ++i) {
+ const MachineOperand &MO = NewMI->getOperand(i);
+
+ if (MO.isRegister() && MO.isDef() &&
+ MRegisterInfo::isVirtualRegister(MO.getReg()))
+ VRegDefs[MO.getReg()] = NewMI;
+ }
// Hoisting was successful! Remove bothersome instruction now.
MI.getParent()->remove(&MI);