summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp14
-rw-r--r--llvm/test/CodeGen/AArch64/machine-copy-remove.ll2
2 files changed, 8 insertions, 8 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;
}
diff --git a/llvm/test/CodeGen/AArch64/machine-copy-remove.ll b/llvm/test/CodeGen/AArch64/machine-copy-remove.ll
index 6a97ead0de8..75954f83c19 100644
--- a/llvm/test/CodeGen/AArch64/machine-copy-remove.ll
+++ b/llvm/test/CodeGen/AArch64/machine-copy-remove.ll
@@ -91,4 +91,4 @@ false:
true:
store volatile i64 %in, i64* %dest
ret i32 0
-} \ No newline at end of file
+}
OpenPOWER on IntegriCloud