diff options
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp b/llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp index b52c19a026d..8def8f32d70 100644 --- a/llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp +++ b/llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp @@ -149,15 +149,15 @@ bool AArch64RedundantCopyElimination::optimizeCopy(MachineBasicBlock *MBB) { // CBZ/CBNZ. Conservatively mark as much as we can live. CompBr->clearRegisterKills(SmallestDef, TRI); - // Clear any kills of TargetReg between CompBr and MI. - if (std::any_of(TargetRegs.begin(), TargetRegs.end(), - [&](unsigned Reg) { return MBB->isLiveIn(Reg); })) { - for (MachineInstr &MMI : - make_range(MBB->begin()->getIterator(), LastChange->getIterator())) - MMI.clearRegisterKills(SmallestDef, TRI); - } else + if (std::none_of(TargetRegs.begin(), TargetRegs.end(), + [&](unsigned Reg) { return MBB->isLiveIn(Reg); })) MBB->addLiveIn(TargetReg); + // Clear any kills of TargetReg between CompBr and the last removed COPY. + for (MachineInstr &MMI : + make_range(MBB->begin()->getIterator(), LastChange->getIterator())) + MMI.clearRegisterKills(SmallestDef, TRI); + return true; } |

