diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-08-18 17:58:09 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-08-18 17:58:09 +0000 |
| commit | 84c2da47f9bbe2e9fb61b3ba28c5bb3039f40c7d (patch) | |
| tree | 504879ee4dae774f73dad5f7f93a516aa78bc31d /llvm/lib/Target | |
| parent | 61a72d88506cbb0b7067bb8176028fe61700b5ed (diff) | |
| download | bcm5719-llvm-84c2da47f9bbe2e9fb61b3ba28c5bb3039f40c7d.tar.gz bcm5719-llvm-84c2da47f9bbe2e9fb61b3ba28c5bb3039f40c7d.zip | |
AArch64: Don't call getIterator() on iterators
Remove an unnecessary round-trip:
iterator => operator->() => getIterator()
In some cases, the iterator is end(), so the dereference of operator->
is invalid (UB).
The testcase only crashes with r278974 (currently reverted to
investigate this), which adds an assertion for invalid dereferences of
ilist nodes.
Fixes PR29035.
llvm-svn: 279104
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp b/llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp index 26a1f5d7047..9e916ef8dd7 100644 --- a/llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp +++ b/llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp @@ -156,8 +156,7 @@ bool AArch64RedundantCopyElimination::optimizeCopy(MachineBasicBlock *MBB) { 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())) + for (MachineInstr &MMI : make_range(MBB->begin(), LastChange)) MMI.clearRegisterKills(SmallestDef, TRI); return true; |

