]> granicus.if.org Git - llvm/commitdiff
[CodeGenPrepare] Rewrite a loop in terms of llvm::none_of. NFC.
authorJustin Lebar <jlebar@google.com>
Mon, 21 Nov 2016 22:49:11 +0000 (22:49 +0000)
committerJustin Lebar <jlebar@google.com>
Mon, 21 Nov 2016 22:49:11 +0000 (22:49 +0000)
Reviewers: arsenm

Subscribers: wdng, llvm-commits

Differential Revision: https://reviews.llvm.org/D26924

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287590 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenPrepare.cpp

index aff4e9519e12b3e8aa895c45e42e491b8209759f..87ad3075873a7b76b85d1bba57e0c7472f7ef5eb 100644 (file)
@@ -3909,18 +3909,10 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
   }
   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;
   }