[llvm-commits] [llvm] r106520 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Dan Gohman
gohman at apple.com
Mon Jun 21 19:07:21 PDT 2010
Author: djg
Date: Mon Jun 21 21:07:21 2010
New Revision: 106520
URL: http://llvm.org/viewvc/llvm-project?rev=106520&view=rev
Log:
When unfolding a load, avoid assuming which instruction that
kill and dead flags will end up on.
Modified:
llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=106520&r1=106519&r2=106520&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Jun 21 21:07:21 2010
@@ -964,10 +964,24 @@
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]);
More information about the llvm-commits
mailing list