[llvm] aa06951 - [IR] Use llvm::is_contained in BasicBlock::removePredecessor (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 15 21:16:10 PST 2020


Author: Kazu Hirata
Date: 2020-11-15T21:15:31-08:00
New Revision: aa0695137791d8e7749dd6be5ea0e6a63bd85854

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

LOG: [IR] Use llvm::is_contained in BasicBlock::removePredecessor (NFC)

Added: 
    

Modified: 
    llvm/lib/IR/BasicBlock.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 64f1d3f3100c..b1d7960190d6 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -326,8 +326,7 @@ iterator_range<BasicBlock::phi_iterator> BasicBlock::phis() {
 void BasicBlock::removePredecessor(BasicBlock *Pred,
                                    bool KeepOneInputPHIs) {
   // Use hasNUsesOrMore to bound the cost of this assertion for complex CFGs.
-  assert((hasNUsesOrMore(16) ||
-          find(pred_begin(this), pred_end(this), Pred) != pred_end(this)) &&
+  assert((hasNUsesOrMore(16) || llvm::is_contained(predecessors(this), Pred)) &&
          "Pred is not a predecessor!");
 
   // Return early if there are no PHI nodes to update.


        


More information about the llvm-commits mailing list