[llvm] r304692 - [InstSimplify] Use llvm::all_of instead of a manual loop. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 4 15:41:56 PDT 2017


Author: ctopper
Date: Sun Jun  4 17:41:56 2017
New Revision: 304692

URL: http://llvm.org/viewvc/llvm-project?rev=304692&view=rev
Log:
[InstSimplify] Use llvm::all_of instead of a manual loop. NFC

Modified:
    llvm/trunk/lib/Analysis/InstructionSimplify.cpp

Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=304692&r1=304691&r2=304692&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Sun Jun  4 17:41:56 2017
@@ -3896,9 +3896,8 @@ static Value *SimplifyGEPInst(Type *SrcT
   }
 
   // Check to see if this is constant foldable.
-  for (unsigned i = 0, e = Ops.size(); i != e; ++i)
-    if (!isa<Constant>(Ops[i]))
-      return nullptr;
+  if (!all_of(Ops, [](Value *V) { return isa<Constant>(V); }))
+    return nullptr;
 
   return ConstantExpr::getGetElementPtr(SrcTy, cast<Constant>(Ops[0]),
                                         Ops.slice(1));




More information about the llvm-commits mailing list