From 8c3304453c22ad1b5a914e64a7f6435f58f4099c Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 22 Jan 2024 21:19:16 -0800 Subject: [PATCH] [llvm-diff] Use llvm::predecessors (NFC) --- llvm/tools/llvm-diff/lib/DifferenceEngine.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/llvm/tools/llvm-diff/lib/DifferenceEngine.cpp b/llvm/tools/llvm-diff/lib/DifferenceEngine.cpp index 0d4d82e5cadd..64b5051af148 100644 --- a/llvm/tools/llvm-diff/lib/DifferenceEngine.cpp +++ b/llvm/tools/llvm-diff/lib/DifferenceEngine.cpp @@ -214,11 +214,9 @@ class FunctionDifferenceEngine { }; unsigned getUnprocPredCount(const BasicBlock *Block) const { - unsigned Count = 0; - for (const_pred_iterator I = pred_begin(Block), E = pred_end(Block); I != E; - ++I) - if (!Blocks.count(*I)) Count++; - return Count; + return llvm::count_if(predecessors(Block), [&](const BasicBlock *Pred) { + return !Blocks.contains(Pred); + }); } typedef std::pair BlockPair;