diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-03-26 22:40:42 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-03-26 22:40:42 +0000 |
commit | ad7ccf34b5de14bd2b9ddc8072d14582a2ce29d9 (patch) | |
tree | 4b2db63d55c7c3cce6634259e4da783da0717eb8 /lib/CodeGen/VirtRegMap.cpp | |
parent | 497b0b0a455dc2300a5b8bb1e64dc3f82afc9acf (diff) |
Fix for PR1266. Don't mark a two address operand IsKill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35365 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/VirtRegMap.cpp')
-rw-r--r-- | lib/CodeGen/VirtRegMap.cpp | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp index dfa5e4383d..6fcbcf24fc 100644 --- a/lib/CodeGen/VirtRegMap.cpp +++ b/lib/CodeGen/VirtRegMap.cpp @@ -754,10 +754,11 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM, // necessary. bool WasKill = false; if (SSMI) { - MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true); - if (MOK) { - WasKill = MOK->isKill(); - MOK->unsetIsKill(); + int UIdx = SSMI->findRegisterUseOperand(PhysReg, true); + if (UIdx != -1) { + MachineOperand &MOK = SSMI->getOperand(UIdx); + WasKill = MOK.isKill(); + MOK.unsetIsKill(); } } if (ti == -1) { @@ -840,17 +841,20 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM, // necessary. bool WasKill = false; if (SSMI) { - MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true); - if (MOK) { - WasKill = MOK->isKill(); - MOK->unsetIsKill(); + int UIdx = SSMI->findRegisterUseOperand(PhysReg, true); + if (UIdx != -1) { + MachineOperand &MOK = SSMI->getOperand(UIdx); + WasKill = MOK.isKill(); + MOK.unsetIsKill(); } } MachineInstr *CopyMI = prior(MII); if (WasKill) { // Transfer kill to the next use. - MachineOperand *MOU = CopyMI->findRegisterUseOperand(PhysReg); - MOU->setIsKill(); + int UIdx = CopyMI->findRegisterUseOperand(PhysReg); + assert(UIdx != -1); + MachineOperand &MOU = CopyMI->getOperand(UIdx); + MOU.setIsKill(); } Spills.addLastUse(PhysReg, CopyMI); @@ -945,18 +949,25 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM, // extended. Remove its kill. bool WasKill = false; if (SSMI) { - MachineOperand *MOK = SSMI->findRegisterUseOperand(InReg, true); - if (MOK) { - WasKill = MOK->isKill(); - MOK->unsetIsKill(); + int UIdx = SSMI->findRegisterUseOperand(InReg, true); + if (UIdx != -1) { + MachineOperand &MOK = SSMI->getOperand(UIdx); + WasKill = MOK.isKill(); + MOK.unsetIsKill(); } } if (NextMII != MBB.end()) { - // If NextMII uses InReg (must be the copy?), mark it killed. - MachineOperand *MOU = NextMII->findRegisterUseOperand(InReg); - if (MOU) { - if (WasKill) - MOU->setIsKill(); + // If NextMII uses InReg and the use is not a two address + // operand, mark it killed. + int UIdx = NextMII->findRegisterUseOperand(InReg); + if (UIdx != -1) { + MachineOperand &MOU = NextMII->getOperand(UIdx); + if (WasKill) { + const TargetInstrDescriptor *NTID = + NextMII->getInstrDescriptor(); + if (NTID->getOperandConstraint(UIdx, TOI::TIED_TO) == -1) + MOU.setIsKill(); + } Spills.addLastUse(InReg, &(*NextMII)); } } |