From a57fabe815ccf016eead526eb3ef475f116ab155 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Thu, 8 Apr 2010 20:02:37 +0000 Subject: Coalescer should not delete copy instructions whose defs are partially dead. e.g. %RDI = MOV64rr %RAX, %EDI git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100804 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineInstr.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/CodeGen/MachineInstr.cpp') 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; } -- cgit v1.2.3-18-g5258