[SimplifyCFG] Use Value::hasNUses instead of 'getNumUses() =='. NFCI

getNumUses is linear in the number of uses. Since we're looking for a specific use count, we can use hasNUses which will stop as soon as it determines there are more than N uses instead of walking all of them.

llvm-svn: 343550
This commit is contained in:
Craig Topper 2018-10-01 23:09:52 +00:00
parent 8e2c75900e
commit d616d33a96
1 changed files with 1 additions and 1 deletions

View File

@ -2001,7 +2001,7 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *ThenBB,
I = SinkCandidateUseCounts.begin(),
E = SinkCandidateUseCounts.end();
I != E; ++I)
if (I->first->getNumUses() == I->second) {
if (I->first->hasNUses(I->second)) {
++SpeculationCost;
if (SpeculationCost > 1)
return false;