forked from OSchip/llvm-project
[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:
parent
8e2c75900e
commit
d616d33a96
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue