From: Chris Lattner Date: Sat, 4 Aug 2007 21:06:15 +0000 (+0000) Subject: Use getNumPreds(BB) instead of computing them manually. This is a very small but X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=127ed3c9299d8315723ffd470b598867fb49c972;p=oota-llvm.git Use getNumPreds(BB) instead of computing them manually. This is a very small but measurable speedup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40823 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index cdccde39725..818c4171d60 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -496,14 +496,14 @@ void PromoteMem2Reg::run() { if (&BB->front() != SomePHI) continue; - // Count the number of preds for BB. - SmallVector Preds(pred_begin(BB), pred_end(BB)); - // Only do work here if there the PHI nodes are missing incoming values. We // know that all PHI nodes that were inserted in a block will have the same // number of incoming values, so we can just check any of them. - if (SomePHI->getNumIncomingValues() == Preds.size()) + if (SomePHI->getNumIncomingValues() == getNumPreds(BB)) continue; + + // Get the preds for BB. + SmallVector Preds(pred_begin(BB), pred_end(BB)); // Ok, now we know that all of the PHI nodes are missing entries for some // basic blocks. Start by sorting the incoming predecessors for efficient