summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-04-08 20:02:37 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-04-08 20:02:37 +0000
commita57fabe815ccf016eead526eb3ef475f116ab155 (patch)
treec5766e5dbbe4131e812a643263b6355ff962132e /lib/CodeGen/MachineInstr.cpp
parentb8db3c2c507cc115ed773209eae6cb8b89db1586 (diff)
downloadllvm-a57fabe815ccf016eead526eb3ef475f116ab155.tar.gz
llvm-a57fabe815ccf016eead526eb3ef475f116ab155.tar.bz2
llvm-a57fabe815ccf016eead526eb3ef475f116ab155.tar.xz
Coalescer should not delete copy instructions whose defs are partially dead. e.g.
%RDI<def,dead> = MOV64rr %RAX<kill>, %EDI<imp-def> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100804 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r--lib/CodeGen/MachineInstr.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index f2ba484e4f..9f03b5bac7 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -1125,6 +1125,19 @@ unsigned MachineInstr::isConstantValuePHI() const {
return Reg;
}
+/// allDefsAreDead - Return true if all the defs of this instruction are dead.
+///
+bool MachineInstr::allDefsAreDead() const {
+ for (unsigned i = 0, e = getNumOperands(); i < e; ++i) {
+ const MachineOperand &MO = getOperand(i);
+ if (!MO.isReg() || MO.isUse())
+ continue;
+ if (!MO.isDead())
+ return false;
+ }
+ return true;
+}
+
void MachineInstr::dump() const {
dbgs() << " " << *this;
}