From 15ff882aa1518948dc0dc40d1fbd26b49f1727d1 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Thu, 11 Mar 2010 02:10:24 +0000 Subject: [PATCH] Fix debug_value handling. llvm-svn: 98224 --- lib/CodeGen/MachineCSE.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/MachineCSE.cpp b/lib/CodeGen/MachineCSE.cpp index ce95d8d05ea..91d36358829 100644 --- a/lib/CodeGen/MachineCSE.cpp +++ b/lib/CodeGen/MachineCSE.cpp @@ -122,8 +122,12 @@ bool MachineCSE::isPhysDefTriviallyDead(unsigned Reg, // Reached end of block, register is obviously dead. return true; - if (I->isDebugValue()) + if (I->isDebugValue()) { + // These must not count against the limit. + ++LookAheadLeft; + ++I; continue; + } bool SeenDef = false; for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { const MachineOperand &MO = I->getOperand(i); @@ -188,7 +192,7 @@ static bool isCopy(const MachineInstr *MI, const TargetInstrInfo *TII) { bool MachineCSE::isCSECandidate(MachineInstr *MI) { if (MI->isLabel() || MI->isPHI() || MI->isImplicitDef() || - MI->isKill() || MI->isInlineAsm()) + MI->isKill() || MI->isInlineAsm() || MI->isDebugValue()) return false; // Ignore copies.