From: Dan Gohman Date: Tue, 22 Jun 2010 00:32:04 +0000 (+0000) Subject: Fix the new load-unfolding code to update LiveVariable's dead flags, X-Git-Tag: android-x86-6.0-r1~1003^2~5540 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7aa7bc735dfca40a20e74ad63a2c27f744699e01;p=android-x86%2Fexternal-llvm.git Fix the new load-unfolding code to update LiveVariable's dead flags, in addition to the kill flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106512 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index 6144ecd002e..017d8b772f9 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -961,8 +961,14 @@ TryInstructionTransform(MachineBasicBlock::iterator &mi, if (LV) { for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { MachineOperand &MO = mi->getOperand(i); - if (MO.isReg() && MO.isUse() && MO.isKill()) - LV->replaceKillInstruction(Reg, mi, NewMIs[0]); + if (MO.isReg() && MO.getReg() != 0 && + TargetRegisterInfo::isVirtualRegister(MO.getReg())) { + if (MO.isUse()) { + if (MO.isKill()) + LV->replaceKillInstruction(MO.getReg(), mi, NewMIs[0]); + } else if (LV->removeVirtualRegisterDead(MO.getReg(), mi)) + LV->addVirtualRegisterDead(MO.getReg(), NewMIs[1]); + } } LV->addVirtualRegisterKilled(Reg, NewMIs[1]); }