Changes in directory llvm/lib/CodeGen:
VirtRegMap.cpp updated: 1.105 -> 1.106 LiveIntervalAnalysis.cpp updated: 1.227 -> 1.228 --- Log message: Fix for PR1266: http://llvm.org/PR1266 . Don't mark a two address operand IsKill. --- Diffs of the changes: (+33 -22) LiveIntervalAnalysis.cpp | 6 ++--- VirtRegMap.cpp | 49 ++++++++++++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 22 deletions(-) Index: llvm/lib/CodeGen/VirtRegMap.cpp diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.105 llvm/lib/CodeGen/VirtRegMap.cpp:1.106 --- llvm/lib/CodeGen/VirtRegMap.cpp:1.105 Tue Mar 20 03:13:50 2007 +++ llvm/lib/CodeGen/VirtRegMap.cpp Mon Mar 26 17:40:42 2007 @@ -754,10 +754,11 @@ // 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 @@ // 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 @@ // 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)); } } Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.227 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.228 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.227 Wed Mar 21 20:26:05 2007 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Mar 26 17:40:42 2007 @@ -854,9 +854,9 @@ // If the source instruction was killing the source register before the // merge, unset the isKill marker given the live range has been extended. - MachineOperand *MOK = ValLREndInst->findRegisterUseOperand(IntB.reg, true); - if (MOK) - MOK->unsetIsKill(); + int UIdx = ValLREndInst->findRegisterUseOperand(IntB.reg, true); + if (UIdx != -1) + ValLREndInst->getOperand(UIdx).unsetIsKill(); // Finally, delete the copy instruction. RemoveMachineInstrFromMaps(CopyMI); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits