mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
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
This commit is contained in:
parent
a762b09310
commit
cc1ca987f3
@ -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]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user