Fix a obvious logic error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82610 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng
2009-09-23 05:23:19 +00:00
parent 4136e7b90e
commit f7cd853071
2 changed files with 139 additions and 15 deletions

View File

@@ -826,21 +826,21 @@ void SimpleRegisterCoalescing::RemoveUnnecessaryKills(unsigned Reg,
MachineInstrIndex UseIdx =
li_->getUseIndex(li_->getInstructionIndex(UseMI));
const LiveRange *LR = LI.getLiveRangeContaining(UseIdx);
if (!LR || !LR->valno->isKill(li_->getNextSlot(UseIdx))) {
if (LR->valno->def != li_->getNextSlot(UseIdx)) {
// Interesting problem. After coalescing reg1027's def and kill are both
// at the same point: %reg1027,0.000000e+00 = [56,814:0) 0@70-(814)
//
// bb5:
// 60 %reg1027<def> = t2MOVr %reg1027, 14, %reg0, %reg0
// 68 %reg1027<def> = t2LDRi12 %reg1027<kill>, 8, 14, %reg0
// 76 t2CMPzri %reg1038<kill,undef>, 0, 14, %reg0, %CPSR<imp-def>
// 84 %reg1027<def> = t2MOVr %reg1027, 14, %reg0, %reg0
// 96 t2Bcc mbb<bb5,0x2030910>, 1, %CPSR<kill>
//
// Do not remove the kill marker on t2LDRi12.
UseMO.setIsKill(false);
}
if (!LR ||
(!LR->valno->isKill(li_->getNextSlot(UseIdx)) &&
LR->valno->def != li_->getNextSlot(UseIdx))) {
// Interesting problem. After coalescing reg1027's def and kill are both
// at the same point: %reg1027,0.000000e+00 = [56,814:0) 0@70-(814)
//
// bb5:
// 60 %reg1027<def> = t2MOVr %reg1027, 14, %reg0, %reg0
// 68 %reg1027<def> = t2LDRi12 %reg1027<kill>, 8, 14, %reg0
// 76 t2CMPzri %reg1038<kill,undef>, 0, 14, %reg0, %CPSR<imp-def>
// 84 %reg1027<def> = t2MOVr %reg1027, 14, %reg0, %reg0
// 96 t2Bcc mbb<bb5,0x2030910>, 1, %CPSR<kill>
//
// Do not remove the kill marker on t2LDRi12.
UseMO.setIsKill(false);
}
}
}