[PATCH] D26924: [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:59:14 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL287590: [CodeGenPrepare] Rewrite a loop in terms of llvm::none_of.  NFC. (authored by jlebar).

Changed prior to commit:
  https://reviews.llvm.org/D26924?vs=78742&id=78789#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26924

Files:
  llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp


Index: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
@@ -3909,18 +3909,10 @@
   }
   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;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26924.78789.patch
Type: text/x-patch
Size: 909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161121/a9a9a497/attachment.bin>


More information about the llvm-commits mailing list