forked from OSchip/llvm-project
Remove getNumUses() comparisons (NFC)
getNumUses() scans the full use list. Don't use it is we only want to check if there's zero or one uses.
This commit is contained in:
parent
60e9ee16b4
commit
b7e2358220
|
@ -144,7 +144,7 @@ public:
|
|||
// If the use is actually in a constant cast expression which itself
|
||||
// has only one use, we look through the constant cast expression.
|
||||
if (auto *CE = dyn_cast<ConstantExpr>(U->getUser()))
|
||||
if (CE->getNumUses() == 1 && CE->isCast())
|
||||
if (CE->hasOneUse() && CE->isCast())
|
||||
U = &*CE->use_begin();
|
||||
|
||||
return (int)CB->getArgOperandNo(U) == CI.ParameterEncoding[0];
|
||||
|
|
|
@ -64,7 +64,7 @@ AbstractCallSite::AbstractCallSite(const Use *U)
|
|||
// This happens by updating the use @p U to the use of the constant
|
||||
// cast expression and afterwards re-initializing CB accordingly.
|
||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(U->getUser()))
|
||||
if (CE->getNumUses() == 1 && CE->isCast()) {
|
||||
if (CE->hasOneUse() && CE->isCast()) {
|
||||
U = &*CE->use_begin();
|
||||
CB = dyn_cast<CallBase>(U->getUser());
|
||||
}
|
||||
|
|
|
@ -584,7 +584,7 @@ void CoroCloner::replaceEntryBlock() {
|
|||
// Move any allocas into Entry that weren't moved into the frame.
|
||||
for (auto IT = OldEntry->begin(), End = OldEntry->end(); IT != End;) {
|
||||
Instruction &I = *IT++;
|
||||
if (!isa<AllocaInst>(&I) || I.getNumUses() == 0)
|
||||
if (!isa<AllocaInst>(&I) || I.use_empty())
|
||||
continue;
|
||||
|
||||
I.moveBefore(*Entry, Entry->getFirstInsertionPt());
|
||||
|
|
|
@ -1293,7 +1293,7 @@ static void createShallowWrapper(Function &F) {
|
|||
F.setLinkage(GlobalValue::InternalLinkage);
|
||||
|
||||
F.replaceAllUsesWith(Wrapper);
|
||||
assert(F.getNumUses() == 0 && "Uses remained after wrapper was created!");
|
||||
assert(F.use_empty() && "Uses remained after wrapper was created!");
|
||||
|
||||
// Move the COMDAT section to the wrapper.
|
||||
// TODO: Check if we need to keep it for F as well.
|
||||
|
|
|
@ -897,7 +897,7 @@ ChangeStatus AAReturnedValuesImpl::manifest(Attributor &A) {
|
|||
|
||||
// Callback to replace the uses of CB with the constant C.
|
||||
auto ReplaceCallSiteUsersWith = [&A](CallBase &CB, Constant &C) {
|
||||
if (CB.getNumUses() == 0)
|
||||
if (CB.use_empty())
|
||||
return ChangeStatus::UNCHANGED;
|
||||
if (A.changeValueAfterManifest(CB, C))
|
||||
return ChangeStatus::CHANGED;
|
||||
|
@ -2267,7 +2267,7 @@ struct AANoAliasFloating final : AANoAliasImpl {
|
|||
if (!CI)
|
||||
break;
|
||||
Value *Base = CI->getOperand(0);
|
||||
if (Base->getNumUses() != 1)
|
||||
if (!Base->hasOneUse())
|
||||
break;
|
||||
Val = Base;
|
||||
} while (true);
|
||||
|
@ -2451,7 +2451,7 @@ struct AANoAliasCallSiteArgument final : AANoAliasImpl {
|
|||
Instruction *UserI = cast<Instruction>(U.getUser());
|
||||
|
||||
// If user if curr instr and only use.
|
||||
if ((UserI == getCtxI()) && (UserI->getNumUses() == 1))
|
||||
if (UserI == getCtxI() && UserI->hasOneUse())
|
||||
return true;
|
||||
|
||||
const Function *ScopeFn = VIRP.getAnchorScope();
|
||||
|
|
|
@ -704,7 +704,7 @@ Value *ConstantOffsetExtractor::removeConstOffset(unsigned ChainIndex) {
|
|||
}
|
||||
|
||||
BinaryOperator *BO = cast<BinaryOperator>(UserChain[ChainIndex]);
|
||||
assert(BO->getNumUses() <= 1 &&
|
||||
assert((BO->use_empty() || BO->hasOneUse()) &&
|
||||
"distributeExtsAndCloneChain clones each BinaryOperator in "
|
||||
"UserChain, so no one should be used more than "
|
||||
"once");
|
||||
|
|
Loading…
Reference in New Issue