diff options
author | Dan Gohman <gohman@apple.com> | 2010-06-22 02:07:21 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-06-22 02:07:21 +0000 |
commit | cc1ca987f35581357f88d6071330e89fc8de2aa1 (patch) | |
tree | ad0414839566fc0e15a3a63b83ef4be5d585215a /lib | |
parent | a762b093107ac3aa438815627006425d0b13a236 (diff) |
When unfolding a load, avoid assuming which instruction that
kill and dead flags will end up on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/TwoAddressInstructionPass.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index 017d8b772f..0c97dad48b 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -964,10 +964,24 @@ TryInstructionTransform(MachineBasicBlock::iterator &mi, 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]); + if (MO.isKill()) { + if (NewMIs[0]->killsRegister(MO.getReg())) + LV->replaceKillInstruction(MO.getReg(), mi, NewMIs[0]); + else { + assert(NewMIs[1]->killsRegister(MO.getReg()) && + "Kill missing after load unfold!"); + LV->replaceKillInstruction(MO.getReg(), mi, NewMIs[1]); + } + } + } else if (LV->removeVirtualRegisterDead(MO.getReg(), mi)) { + if (NewMIs[1]->registerDefIsDead(MO.getReg())) + LV->addVirtualRegisterDead(MO.getReg(), NewMIs[1]); + else { + assert(NewMIs[0]->registerDefIsDead(MO.getReg()) && + "Dead flag missing after load unfold!"); + LV->addVirtualRegisterDead(MO.getReg(), NewMIs[0]); + } + } } } LV->addVirtualRegisterKilled(Reg, NewMIs[1]); |