[llvm-branch-commits] [llvm] 9178c63 - [IR] Use llvm::is_contained and pred_size (NFC)

Kazu Hirata via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 26 22:06:51 PST 2020


Author: Kazu Hirata
Date: 2020-11-26T22:02:04-08:00
New Revision: 9178c630c3418a53973fc70c0c169834befddbbd

URL: https://github.com/llvm/llvm-project/commit/9178c630c3418a53973fc70c0c169834befddbbd
DIFF: https://github.com/llvm/llvm-project/commit/9178c630c3418a53973fc70c0c169834befddbbd.diff

LOG: [IR] Use llvm::is_contained and pred_size (NFC)

Added: 
    

Modified: 
    llvm/include/llvm/IR/InstrTypes.h
    llvm/include/llvm/IR/PredIteratorCache.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 5d3b603ad01b..1091c4b0dc0f 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -1338,7 +1338,7 @@ class CallBase : public Instruction {
   /// Returns true if this CallSite passes the given Value* as an argument to
   /// the called function.
   bool hasArgument(const Value *V) const {
-    return llvm::any_of(args(), [V](const Value *Arg) { return Arg == V; });
+    return llvm::is_contained(args(), V);
   }
 
   Value *getCalledOperand() const { return Op<CalledOperandOpEndIdx>(); }

diff  --git a/llvm/include/llvm/IR/PredIteratorCache.h b/llvm/include/llvm/IR/PredIteratorCache.h
index cc835277910b..4d8efcfa9eab 100644
--- a/llvm/include/llvm/IR/PredIteratorCache.h
+++ b/llvm/include/llvm/IR/PredIteratorCache.h
@@ -58,7 +58,7 @@ class PredIteratorCache {
     auto Result = BlockToPredCountMap.find(BB);
     if (Result != BlockToPredCountMap.end())
       return Result->second;
-    return BlockToPredCountMap[BB] = std::distance(pred_begin(BB), pred_end(BB));
+    return BlockToPredCountMap[BB] = pred_size(BB);
   }
 
 public:


        


More information about the llvm-branch-commits mailing list