diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-05-07 00:49:28 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-05-07 00:49:28 +0000 |
commit | 7ebc06bfd8df4cd7c477af1e5fec196c32efcfea (patch) | |
tree | 538a98ba638ffa877ec3c9c9e134295b5907e85e /lib/CodeGen/VirtRegMap.cpp | |
parent | 42ac929ed968939d22a715769e583aeed8f6c823 (diff) |
Yet another nasty spiller bug.
%ecx = op
store %cl<kill>, (addr)
(addr) = op %al
It's not safe to unfold the last operand and eliminate store even though %cl is marked kill. It's a sub-register use which means one of its super-register(s) may be used below.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50794 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/VirtRegMap.cpp')
-rw-r--r-- | lib/CodeGen/VirtRegMap.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp index 6a34269cea..fe8b6a5a63 100644 --- a/lib/CodeGen/VirtRegMap.cpp +++ b/lib/CodeGen/VirtRegMap.cpp @@ -1465,20 +1465,25 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) { // the value and there isn't an earlier def that has already clobbered // the physreg. if (PhysReg && - !TII->isStoreToStackSlot(&MI, SS) && // Not profitable! - DeadStore->killsRegister(PhysReg) && - TII->unfoldMemoryOperand(MF, &MI, PhysReg, false, true, NewMIs)) { - MBB.insert(MII, NewMIs[0]); - NewStore = NewMIs[1]; - MBB.insert(MII, NewStore); - VRM.addSpillSlotUse(SS, NewStore); - VRM.RemoveMachineInstrFromMaps(&MI); - MBB.erase(&MI); - Erased = true; - --NextMII; - --NextMII; // backtrack to the unfolded instruction. - BackTracked = true; - isDead = true; + !TII->isStoreToStackSlot(&MI, SS)) { // Not profitable! + MachineOperand *KillOpnd = + DeadStore->findRegisterUseOperand(PhysReg, true); + // Note, if the store is storing a sub-register, it's possible the + // super-register is needed below. + if (KillOpnd && !KillOpnd->getSubReg() && + TII->unfoldMemoryOperand(MF, &MI, PhysReg, false, true,NewMIs)){ + MBB.insert(MII, NewMIs[0]); + NewStore = NewMIs[1]; + MBB.insert(MII, NewStore); + VRM.addSpillSlotUse(SS, NewStore); + VRM.RemoveMachineInstrFromMaps(&MI); + MBB.erase(&MI); + Erased = true; + --NextMII; + --NextMII; // backtrack to the unfolded instruction. + BackTracked = true; + isDead = true; + } } } |