diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2010-04-08 20:02:37 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2010-04-08 20:02:37 +0000 |
| commit | b083c47c21054a70543566fc55a98b04b7229dee (patch) | |
| tree | b0eab3df5ad3dd9019ac202a3715875015f345f9 /llvm/lib/CodeGen/MachineInstr.cpp | |
| parent | ea4a5abf61b80c3020c63bf52d43cbb73b546af5 (diff) | |
| download | bcm5719-llvm-b083c47c21054a70543566fc55a98b04b7229dee.tar.gz bcm5719-llvm-b083c47c21054a70543566fc55a98b04b7229dee.zip | |
Coalescer should not delete copy instructions whose defs are partially dead. e.g.
%RDI<def,dead> = MOV64rr %RAX<kill>, %EDI<imp-def>
llvm-svn: 100804
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index f2ba484e4f0..9f03b5bac70 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/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; } |

