[SimplifyCFG] Use hasNUses instead of comparing getNumUses to a constant."

The use list is a linked list so getNumUses requires a linear scan through the whole list. hasNUses will stop scanning at N and see if that is the end.

llvm-svn: 300505
This commit is contained in:
Craig Topper 2017-04-17 22:13:00 +00:00
parent fb289ecde0
commit c228068d90
1 changed files with 1 additions and 1 deletions

View File

@ -3086,7 +3086,7 @@ static bool mergeConditionalStores(BranchInst *PBI, BranchInst *QBI) {
if ((PTB && !HasOnePredAndOneSucc(PTB, PBI->getParent(), QBI->getParent())) || if ((PTB && !HasOnePredAndOneSucc(PTB, PBI->getParent(), QBI->getParent())) ||
(QTB && !HasOnePredAndOneSucc(QTB, QBI->getParent(), PostBB))) (QTB && !HasOnePredAndOneSucc(QTB, QBI->getParent(), PostBB)))
return false; return false;
if (PostBB->getNumUses() != 2 || QBI->getParent()->getNumUses() != 2) if (!PostBB->hasNUses(2) || !QBI->getParent()->hasNUses(2))
return false; return false;
// OK, this is a sequence of two diamonds or triangles. // OK, this is a sequence of two diamonds or triangles.