summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-11-16 03:47:42 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-11-16 03:47:42 +0000
commitb8c55a5339f48b7ac3bc168aa53dd79a03e573e3 (patch)
tree584eecc361d28d6cd2d73a8e0c4381595690e143 /llvm/lib/CodeGen
parent59f8156ea0a45a63f6d2e483081d483ce3f60e6a (diff)
downloadbcm5719-llvm-b8c55a5339f48b7ac3bc168aa53dd79a03e573e3.tar.gz
bcm5719-llvm-b8c55a5339f48b7ac3bc168aa53dd79a03e573e3.zip
If the 2addr instruction has other kills, don't move it below any other uses since we don't want to extend other live ranges.
llvm-svn: 144772
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/TwoAddressInstructionPass.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index 3e9a0e44e93..7a0fcb5651c 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -933,6 +933,7 @@ TwoAddressInstructionPass::RescheduleMIBelowKill(MachineBasicBlock *MBB,
return false;
SmallSet<unsigned, 2> Uses;
+ SmallSet<unsigned, 2> Kills;
SmallSet<unsigned, 2> Defs;
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
const MachineOperand &MO = MI->getOperand(i);
@@ -943,8 +944,11 @@ TwoAddressInstructionPass::RescheduleMIBelowKill(MachineBasicBlock *MBB,
continue;
if (MO.isDef())
Defs.insert(MOReg);
- else
+ else {
Uses.insert(MOReg);
+ if (MO.isKill() && MOReg != Reg)
+ Kills.insert(MOReg);
+ }
}
// Move the copies connected to MI down as well.
@@ -991,7 +995,8 @@ TwoAddressInstructionPass::RescheduleMIBelowKill(MachineBasicBlock *MBB,
} else {
if (Defs.count(MOReg))
return false;
- if (MOReg != Reg && MO.isKill() && Uses.count(MOReg))
+ if (MOReg != Reg &&
+ ((MO.isKill() && Uses.count(MOReg)) || Kills.count(MOReg)))
// Don't want to extend other live ranges and update kills.
return false;
}
OpenPOWER on IntegriCloud