diff --git a/include/llvm/IR/AbstractCallSite.h b/include/llvm/IR/AbstractCallSite.h index 559da857851..c78afc729d4 100644 --- a/include/llvm/IR/AbstractCallSite.h +++ b/include/llvm/IR/AbstractCallSite.h @@ -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(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]; diff --git a/lib/IR/AbstractCallSite.cpp b/lib/IR/AbstractCallSite.cpp index 1f7371607b8..6504e566ba4 100644 --- a/lib/IR/AbstractCallSite.cpp +++ b/lib/IR/AbstractCallSite.cpp @@ -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(U->getUser())) - if (CE->getNumUses() == 1 && CE->isCast()) { + if (CE->hasOneUse() && CE->isCast()) { U = &*CE->use_begin(); CB = dyn_cast(U->getUser()); } diff --git a/lib/Transforms/Coroutines/CoroSplit.cpp b/lib/Transforms/Coroutines/CoroSplit.cpp index 7d719fd084c..1e0bdc168e5 100644 --- a/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/lib/Transforms/Coroutines/CoroSplit.cpp @@ -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(&I) || I.getNumUses() == 0) + if (!isa(&I) || I.use_empty()) continue; I.moveBefore(*Entry, Entry->getFirstInsertionPt()); diff --git a/lib/Transforms/IPO/Attributor.cpp b/lib/Transforms/IPO/Attributor.cpp index aafeb6ebd92..04fc4108d8d 100644 --- a/lib/Transforms/IPO/Attributor.cpp +++ b/lib/Transforms/IPO/Attributor.cpp @@ -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. diff --git a/lib/Transforms/IPO/AttributorAttributes.cpp b/lib/Transforms/IPO/AttributorAttributes.cpp index aeb1029ed00..eff08bd3f48 100644 --- a/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/lib/Transforms/IPO/AttributorAttributes.cpp @@ -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(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(); diff --git a/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp b/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp index 0d375bb3a6e..f1d2e3c1ecf 100644 --- a/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp +++ b/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp @@ -704,7 +704,7 @@ Value *ConstantOffsetExtractor::removeConstOffset(unsigned ChainIndex) { } BinaryOperator *BO = cast(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");