[llvm] r287590 - [CodeGenPrepare] Rewrite a loop in terms of llvm::none_of. NFC.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 21 14:49:11 PST 2016
Author: jlebar
Date: Mon Nov 21 16:49:11 2016
New Revision: 287590
URL: http://llvm.org/viewvc/llvm-project?rev=287590&view=rev
Log:
[CodeGenPrepare] Rewrite a loop in terms of llvm::none_of. NFC.
Reviewers: arsenm
Subscribers: wdng, llvm-commits
Differential Revision: https://reviews.llvm.org/D26924
Modified:
llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=287590&r1=287589&r2=287590&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Mon Nov 21 16:49:11 2016
@@ -3909,18 +3909,10 @@ bool CodeGenPrepare::optimizeMemoryInst(
}
TPT.commit();
- // Check to see if any of the instructions supersumed by this addr mode are
- // non-local to I's BB.
- bool AnyNonLocal = false;
- for (unsigned i = 0, e = AddrModeInsts.size(); i != e; ++i) {
- if (IsNonLocalValue(AddrModeInsts[i], MemoryInst->getParent())) {
- AnyNonLocal = true;
- break;
- }
- }
-
// If all the instructions matched are already in this BB, don't do anything.
- if (!AnyNonLocal) {
+ if (none_of(AddrModeInsts, [&](Value *V) {
+ return IsNonLocalValue(V, MemoryInst->getParent());
+ })) {
DEBUG(dbgs() << "CGP: Found local addrmode: " << AddrMode << "\n");
return false;
}
More information about the llvm-commits
mailing list