Skip to content

Commit 4f0225f

Browse files
[Transforms] Migrate from getNumArgOperands to arg_size (NFC)
Note that getNumArgOperands is considered a legacy name. See llvm/include/llvm/IR/InstrTypes.h for details.
1 parent 5b44c71 commit 4f0225f

26 files changed

+67
-71
lines changed

llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ struct AllocaUseVisitor : PtrUseVisitor<AllocaUseVisitor> {
13551355
}
13561356

13571357
void visitCallBase(CallBase &CB) {
1358-
for (unsigned Op = 0, OpCount = CB.getNumArgOperands(); Op < OpCount; ++Op)
1358+
for (unsigned Op = 0, OpCount = CB.arg_size(); Op < OpCount; ++Op)
13591359
if (U->get() == CB.getArgOperand(Op) && !CB.doesNotCapture(Op))
13601360
PI.setEscaped(&CB);
13611361
handleMayWrite(CB);

llvm/lib/Transforms/Coroutines/CoroInstr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ class LLVM_LIBRARY_VISIBILITY CoroAsyncEndInst : public AnyCoroEndInst {
638638
void checkWellFormed() const;
639639

640640
Function *getMustTailCallFunction() const {
641-
if (getNumArgOperands() < 3)
641+
if (arg_size() < 3)
642642
return nullptr;
643643

644644
return cast<Function>(

llvm/lib/Transforms/Coroutines/CoroSplit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static void replaceSwiftErrorOps(Function &F, coro::Shape &Shape,
627627
auto Slot = getSwiftErrorSlot(ValueTy);
628628
MappedResult = Builder.CreateLoad(ValueTy, Slot);
629629
} else {
630-
assert(Op->getNumArgOperands() == 1);
630+
assert(Op->arg_size() == 1);
631631
auto Value = MappedOp->getArgOperand(0);
632632
auto ValueTy = Value->getType();
633633
auto Slot = getSwiftErrorSlot(ValueTy);

llvm/lib/Transforms/Coroutines/Coroutines.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ void CoroAsyncEndInst::checkWellFormed() const {
722722
return;
723723
auto *FnTy =
724724
cast<FunctionType>(MustTailCallFunc->getType()->getPointerElementType());
725-
if (FnTy->getNumParams() != (getNumArgOperands() - 3))
725+
if (FnTy->getNumParams() != (arg_size() - 3))
726726
fail(this,
727727
"llvm.coro.end.async must tail call function argument type must "
728728
"match the tail arguments",

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2592,7 +2592,7 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) {
25922592
getOrCreateAAFor<AAValueSimplify>(CBRetPos);
25932593
}
25942594

2595-
for (int I = 0, E = CB.getNumArgOperands(); I < E; ++I) {
2595+
for (int I = 0, E = CB.arg_size(); I < E; ++I) {
25962596

25972597
IRPosition CBArgPos = IRPosition::callsite_argument(CB, I);
25982598

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2515,7 +2515,7 @@ struct AAUndefinedBehaviorImpl : public AAUndefinedBehavior {
25152515
Function *Callee = CB.getCalledFunction();
25162516
if (!Callee)
25172517
return true;
2518-
for (unsigned idx = 0; idx < CB.getNumArgOperands(); idx++) {
2518+
for (unsigned idx = 0; idx < CB.arg_size(); idx++) {
25192519
// If current argument is known to be simplified to null pointer and the
25202520
// corresponding argument position is known to have nonnull attribute,
25212521
// the argument is poison. Furthermore, if the argument is poison and
@@ -3183,8 +3183,7 @@ struct AANoAliasCallSiteArgument final : AANoAliasImpl {
31833183
// value passed at this call site.
31843184
// TODO: AbstractCallSite
31853185
const auto &CB = cast<CallBase>(getAnchorValue());
3186-
for (unsigned OtherArgNo = 0; OtherArgNo < CB.getNumArgOperands();
3187-
OtherArgNo++)
3186+
for (unsigned OtherArgNo = 0; OtherArgNo < CB.arg_size(); OtherArgNo++)
31883187
if (mayAliasWithArgument(A, AAR, MemBehaviorAA, CB, OtherArgNo))
31893188
return false;
31903189

@@ -6516,7 +6515,7 @@ struct AAPrivatizablePtrArgument final : public AAPrivatizablePtrImpl {
65166515
auto IsCompatiblePrivArgOfDirectCS = [&](AbstractCallSite ACS) {
65176516
CallBase *DC = cast<CallBase>(ACS.getInstruction());
65186517
int DCArgNo = ACS.getCallArgOperandNo(ArgNo);
6519-
assert(DCArgNo >= 0 && unsigned(DCArgNo) < DC->getNumArgOperands() &&
6518+
assert(DCArgNo >= 0 && unsigned(DCArgNo) < DC->arg_size() &&
65206519
"Expected a direct call operand for callback call operand");
65216520

65226521
LLVM_DEBUG({
@@ -7733,7 +7732,7 @@ void AAMemoryLocationImpl::categorizePtrValue(
77337732
void AAMemoryLocationImpl::categorizeArgumentPointerLocations(
77347733
Attributor &A, CallBase &CB, AAMemoryLocation::StateType &AccessedLocs,
77357734
bool &Changed) {
7736-
for (unsigned ArgNo = 0, E = CB.getNumArgOperands(); ArgNo < E; ++ArgNo) {
7735+
for (unsigned ArgNo = 0, E = CB.arg_size(); ArgNo < E; ++ArgNo) {
77377736

77387737
// Skip non-pointer arguments.
77397738
const Value *ArgOp = CB.getArgOperand(ArgNo);

llvm/lib/Transforms/IPO/FunctionAttrs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ struct ArgumentUsesTracker : public CaptureTracker {
593593
assert(UseIndex < CB->data_operands_size() &&
594594
"Indirect function calls should have been filtered above!");
595595

596-
if (UseIndex >= CB->getNumArgOperands()) {
596+
if (UseIndex >= CB->arg_size()) {
597597
// Data operand, but not a argument operand -- must be a bundle operand
598598
assert(CB->hasOperandBundles() && "Must be!");
599599

@@ -728,7 +728,7 @@ determinePointerReadAttrs(Argument *A,
728728
assert(UseIndex < CB.data_operands_size() &&
729729
"Data operand use expected!");
730730

731-
bool IsOperandBundleUse = UseIndex >= CB.getNumArgOperands();
731+
bool IsOperandBundleUse = UseIndex >= CB.arg_size();
732732

733733
if (UseIndex >= F->arg_size() && !IsOperandBundleUse) {
734734
assert(F->isVarArg() && "More params than args in non-varargs call");

llvm/lib/Transforms/IPO/LowerTypeTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,11 +2100,11 @@ bool LowerTypeTestsModule::lower() {
21002100
auto CI = cast<CallInst>(U.getUser());
21012101

21022102
std::vector<GlobalTypeMember *> Targets;
2103-
if (CI->getNumArgOperands() % 2 != 1)
2103+
if (CI->arg_size() % 2 != 1)
21042104
report_fatal_error("number of arguments should be odd");
21052105

21062106
GlobalClassesTy::member_iterator CurSet;
2107-
for (unsigned I = 1; I != CI->getNumArgOperands(); I += 2) {
2107+
for (unsigned I = 1; I != CI->arg_size(); I += 2) {
21082108
int64_t Offset;
21092109
auto *Base = dyn_cast<GlobalObject>(GetPointerBaseWithConstantOffset(
21102110
CI->getOperand(I), Offset, M.getDataLayout()));

llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,17 +1077,17 @@ struct OpenMPOpt {
10771077
Args.clear();
10781078
Args.push_back(OutlinedFn->getArg(0));
10791079
Args.push_back(OutlinedFn->getArg(1));
1080-
for (unsigned U = CallbackFirstArgOperand, E = CI->getNumArgOperands();
1081-
U < E; ++U)
1080+
for (unsigned U = CallbackFirstArgOperand, E = CI->arg_size(); U < E;
1081+
++U)
10821082
Args.push_back(CI->getArgOperand(U));
10831083

10841084
CallInst *NewCI = CallInst::Create(FT, Callee, Args, "", CI);
10851085
if (CI->getDebugLoc())
10861086
NewCI->setDebugLoc(CI->getDebugLoc());
10871087

10881088
// Forward parameter attributes from the callback to the callee.
1089-
for (unsigned U = CallbackFirstArgOperand, E = CI->getNumArgOperands();
1090-
U < E; ++U)
1089+
for (unsigned U = CallbackFirstArgOperand, E = CI->arg_size(); U < E;
1090+
++U)
10911091
for (const Attribute &A : CI->getAttributes().getParamAttrs(U))
10921092
NewCI->addParamAttr(
10931093
U - (CallbackFirstArgOperand - CallbackCalleeOperand), A);
@@ -1608,7 +1608,7 @@ struct OpenMPOpt {
16081608

16091609
// TODO: Use dominance to find a good position instead.
16101610
auto CanBeMoved = [this](CallBase &CB) {
1611-
unsigned NumArgs = CB.getNumArgOperands();
1611+
unsigned NumArgs = CB.arg_size();
16121612
if (NumArgs == 0)
16131613
return true;
16141614
if (CB.getArgOperand(0)->getType() != OMPInfoCache.OMPBuilder.IdentPtr)

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,8 @@ static Value *simplifyNeonTbl1(const IntrinsicInst &II,
656656
// comparison to the first NumOperands.
657657
static bool haveSameOperands(const IntrinsicInst &I, const IntrinsicInst &E,
658658
unsigned NumOperands) {
659-
assert(I.getNumArgOperands() >= NumOperands && "Not enough operands");
660-
assert(E.getNumArgOperands() >= NumOperands && "Not enough operands");
659+
assert(I.arg_size() >= NumOperands && "Not enough operands");
660+
assert(E.arg_size() >= NumOperands && "Not enough operands");
661661
for (unsigned i = 0; i < NumOperands; i++)
662662
if (I.getArgOperand(i) != E.getArgOperand(i))
663663
return false;
@@ -686,7 +686,7 @@ removeTriviallyEmptyRange(IntrinsicInst &EndI, InstCombinerImpl &IC,
686686
I->getIntrinsicID() == EndI.getIntrinsicID())
687687
continue;
688688
if (IsStart(*I)) {
689-
if (haveSameOperands(EndI, *I, EndI.getNumArgOperands())) {
689+
if (haveSameOperands(EndI, *I, EndI.arg_size())) {
690690
IC.eraseInstFromFunction(*I);
691691
IC.eraseInstFromFunction(EndI);
692692
return true;
@@ -710,7 +710,7 @@ Instruction *InstCombinerImpl::visitVAEndInst(VAEndInst &I) {
710710
}
711711

712712
static CallInst *canonicalizeConstantArg0ToArg1(CallInst &Call) {
713-
assert(Call.getNumArgOperands() > 1 && "Need at least 2 args to swap");
713+
assert(Call.arg_size() > 1 && "Need at least 2 args to swap");
714714
Value *Arg0 = Call.getArgOperand(0), *Arg1 = Call.getArgOperand(1);
715715
if (isa<Constant>(Arg0) && !isa<Constant>(Arg1)) {
716716
Call.setArgOperand(0, Arg1);
@@ -2517,7 +2517,7 @@ static IntrinsicInst *findInitTrampoline(Value *Callee) {
25172517
}
25182518

25192519
void InstCombinerImpl::annotateAnyAllocSite(CallBase &Call, const TargetLibraryInfo *TLI) {
2520-
unsigned NumArgs = Call.getNumArgOperands();
2520+
unsigned NumArgs = Call.arg_size();
25212521
ConstantInt *Op0C = dyn_cast<ConstantInt>(Call.getOperand(0));
25222522
ConstantInt *Op1C =
25232523
(NumArgs == 1) ? nullptr : dyn_cast<ConstantInt>(Call.getOperand(1));

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,14 +962,14 @@ static Value *foldOperationIntoSelectOperand(Instruction &I, Value *SO,
962962
assert(canConstantFoldCallTo(II, cast<Function>(II->getCalledOperand())) &&
963963
"Expected constant-foldable intrinsic");
964964
Intrinsic::ID IID = II->getIntrinsicID();
965-
if (II->getNumArgOperands() == 1)
965+
if (II->arg_size() == 1)
966966
return Builder.CreateUnaryIntrinsic(IID, SO);
967967

968968
// This works for real binary ops like min/max (where we always expect the
969969
// constant operand to be canonicalized as op1) and unary ops with a bonus
970970
// constant argument like ctlz/cttz.
971971
// TODO: Handle non-commutative binary intrinsics as below for binops.
972-
assert(II->getNumArgOperands() == 2 && "Expected binary intrinsic");
972+
assert(II->arg_size() == 2 && "Expected binary intrinsic");
973973
assert(isa<Constant>(II->getArgOperand(1)) && "Expected constant operand");
974974
return Builder.CreateBinaryIntrinsic(IID, SO, II->getArgOperand(1));
975975
}

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,7 @@ void AddressSanitizer::getInterestingMemoryOperands(
15351535
Value *Mask = CI->getOperand(2 + OpOffset);
15361536
Interesting.emplace_back(I, OpOffset, IsWrite, Ty, Alignment, Mask);
15371537
} else {
1538-
for (unsigned ArgNo = 0; ArgNo < CI->getNumArgOperands(); ArgNo++) {
1538+
for (unsigned ArgNo = 0; ArgNo < CI->arg_size(); ArgNo++) {
15391539
if (!ClInstrumentByval || !CI->isByValArgument(ArgNo) ||
15401540
ignoreAccess(CI->getArgOperand(ArgNo)))
15411541
continue;
@@ -2982,7 +2982,8 @@ bool AddressSanitizer::LooksLikeCodeInBug11395(Instruction *I) {
29822982
if (LongSize != 32) return false;
29832983
CallInst *CI = dyn_cast<CallInst>(I);
29842984
if (!CI || !CI->isInlineAsm()) return false;
2985-
if (CI->getNumArgOperands() <= 5) return false;
2985+
if (CI->arg_size() <= 5)
2986+
return false;
29862987
// We have inline assembly with quite a few arguments.
29872988
return true;
29882989
}

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ void HWAddressSanitizer::getInterestingMemoryOperands(
839839
Interesting.emplace_back(I, XCHG->getPointerOperandIndex(), true,
840840
XCHG->getCompareOperand()->getType(), None);
841841
} else if (auto CI = dyn_cast<CallInst>(I)) {
842-
for (unsigned ArgNo = 0; ArgNo < CI->getNumArgOperands(); ArgNo++) {
842+
for (unsigned ArgNo = 0; ArgNo < CI->arg_size(); ArgNo++) {
843843
if (!ClInstrumentByval || !CI->isByValArgument(ArgNo) ||
844844
ignoreAccess(I, CI->getArgOperand(ArgNo)))
845845
continue;

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
26742674
RetTy->isX86_MMXTy()))
26752675
return false;
26762676

2677-
unsigned NumArgOperands = I.getNumArgOperands();
2677+
unsigned NumArgOperands = I.arg_size();
26782678
for (unsigned i = 0; i < NumArgOperands; ++i) {
26792679
Type *Ty = I.getArgOperand(i)->getType();
26802680
if (Ty != RetTy)
@@ -2701,7 +2701,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
27012701
/// We special-case intrinsics where this approach fails. See llvm.bswap
27022702
/// handling as an example of that.
27032703
bool handleUnknownIntrinsic(IntrinsicInst &I) {
2704-
unsigned NumArgOperands = I.getNumArgOperands();
2704+
unsigned NumArgOperands = I.arg_size();
27052705
if (NumArgOperands == 0)
27062706
return false;
27072707

@@ -2775,10 +2775,10 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
27752775
Value *CopyOp, *ConvertOp;
27762776

27772777
assert((!HasRoundingMode ||
2778-
isa<ConstantInt>(I.getArgOperand(I.getNumArgOperands() - 1))) &&
2778+
isa<ConstantInt>(I.getArgOperand(I.arg_size() - 1))) &&
27792779
"Invalid rounding mode");
27802780

2781-
switch (I.getNumArgOperands() - HasRoundingMode) {
2781+
switch (I.arg_size() - HasRoundingMode) {
27822782
case 2:
27832783
CopyOp = I.getArgOperand(0);
27842784
ConvertOp = I.getArgOperand(1);
@@ -2867,7 +2867,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
28672867
// size, and the rest is ignored. Behavior is defined even if shift size is
28682868
// greater than register (or field) width.
28692869
void handleVectorShiftIntrinsic(IntrinsicInst &I, bool Variable) {
2870-
assert(I.getNumArgOperands() == 2);
2870+
assert(I.arg_size() == 2);
28712871
IRBuilder<> IRB(&I);
28722872
// If any of the S2 bits are poisoned, the whole thing is poisoned.
28732873
// Otherwise perform the same shift on S1.
@@ -2932,7 +2932,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
29322932
// to sext(Sa != zeroinitializer), sext(Sb != zeroinitializer).
29332933
// EltSizeInBits is used only for x86mmx arguments.
29342934
void handleVectorPackIntrinsic(IntrinsicInst &I, unsigned EltSizeInBits = 0) {
2935-
assert(I.getNumArgOperands() == 2);
2935+
assert(I.arg_size() == 2);
29362936
bool isX86_MMX = I.getOperand(0)->getType()->isX86_MMXTy();
29372937
IRBuilder<> IRB(&I);
29382938
Value *S1 = getShadow(&I, 0);

llvm/lib/Transforms/Scalar/EarlyCSE.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static unsigned getHashValueImpl(SimpleValue Val) {
293293
// TODO: Extend this to handle intrinsics with >2 operands where the 1st
294294
// 2 operands are commutative.
295295
auto *II = dyn_cast<IntrinsicInst>(Inst);
296-
if (II && II->isCommutative() && II->getNumArgOperands() == 2) {
296+
if (II && II->isCommutative() && II->arg_size() == 2) {
297297
Value *LHS = II->getArgOperand(0), *RHS = II->getArgOperand(1);
298298
if (LHS > RHS)
299299
std::swap(LHS, RHS);
@@ -363,7 +363,7 @@ static bool isEqualImpl(SimpleValue LHS, SimpleValue RHS) {
363363
auto *LII = dyn_cast<IntrinsicInst>(LHSI);
364364
auto *RII = dyn_cast<IntrinsicInst>(RHSI);
365365
if (LII && RII && LII->getIntrinsicID() == RII->getIntrinsicID() &&
366-
LII->isCommutative() && LII->getNumArgOperands() == 2) {
366+
LII->isCommutative() && LII->arg_size() == 2) {
367367
return LII->getArgOperand(0) == RII->getArgOperand(1) &&
368368
LII->getArgOperand(1) == RII->getArgOperand(0);
369369
}

llvm/lib/Transforms/Scalar/GVN.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,12 @@ uint32_t GVN::ValueTable::lookupOrAddCall(CallInst *C) {
421421
// a normal load or store instruction.
422422
CallInst *local_cdep = dyn_cast<CallInst>(local_dep.getInst());
423423

424-
if (!local_cdep ||
425-
local_cdep->getNumArgOperands() != C->getNumArgOperands()) {
424+
if (!local_cdep || local_cdep->arg_size() != C->arg_size()) {
426425
valueNumbering[C] = nextValueNumber;
427426
return nextValueNumber++;
428427
}
429428

430-
for (unsigned i = 0, e = C->getNumArgOperands(); i < e; ++i) {
429+
for (unsigned i = 0, e = C->arg_size(); i < e; ++i) {
431430
uint32_t c_vn = lookupOrAdd(C->getArgOperand(i));
432431
uint32_t cd_vn = lookupOrAdd(local_cdep->getArgOperand(i));
433432
if (c_vn != cd_vn) {
@@ -477,11 +476,11 @@ uint32_t GVN::ValueTable::lookupOrAddCall(CallInst *C) {
477476
return nextValueNumber++;
478477
}
479478

480-
if (cdep->getNumArgOperands() != C->getNumArgOperands()) {
479+
if (cdep->arg_size() != C->arg_size()) {
481480
valueNumbering[C] = nextValueNumber;
482481
return nextValueNumber++;
483482
}
484-
for (unsigned i = 0, e = C->getNumArgOperands(); i < e; ++i) {
483+
for (unsigned i = 0, e = C->arg_size(); i < e; ++i) {
485484
uint32_t c_vn = lookupOrAdd(C->getArgOperand(i));
486485
uint32_t cd_vn = lookupOrAdd(cdep->getArgOperand(i));
487486
if (c_vn != cd_vn) {

llvm/lib/Transforms/Scalar/Scalarizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ bool ScalarizerVisitor::splitCall(CallInst &CI) {
530530
return false;
531531

532532
unsigned NumElems = cast<FixedVectorType>(VT)->getNumElements();
533-
unsigned NumArgs = CI.getNumArgOperands();
533+
unsigned NumArgs = CI.arg_size();
534534

535535
ValueVector ScalarOperands(NumArgs);
536536
SmallVector<Scatterer, 8> Scattered(NumArgs);

llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,15 +667,15 @@ bool TailRecursionEliminator::eliminateCall(CallInst *CI) {
667667
createTailRecurseLoopHeader(CI);
668668

669669
// Copy values of ByVal operands into local temporarily variables.
670-
for (unsigned I = 0, E = CI->getNumArgOperands(); I != E; ++I) {
670+
for (unsigned I = 0, E = CI->arg_size(); I != E; ++I) {
671671
if (CI->isByValArgument(I))
672672
copyByValueOperandIntoLocalTemp(CI, I);
673673
}
674674

675675
// Ok, now that we know we have a pseudo-entry block WITH all of the
676676
// required PHI nodes, add entries into the PHI node for the actual
677677
// parameters passed into the tail-recursive call.
678-
for (unsigned I = 0, E = CI->getNumArgOperands(); I != E; ++I) {
678+
for (unsigned I = 0, E = CI->arg_size(); I != E; ++I) {
679679
if (CI->isByValArgument(I)) {
680680
copyLocalTempOfByValueOperandIntoArguments(CI, I);
681681
ArgumentPHIs[I]->addIncoming(F.getArg(I), BB);

llvm/lib/Transforms/Utils/Evaluator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ bool Evaluator::getFormalParams(CallBase &CB, Function *F,
284284
return false;
285285

286286
auto *FTy = F->getFunctionType();
287-
if (FTy->getNumParams() > CB.getNumArgOperands()) {
287+
if (FTy->getNumParams() > CB.arg_size()) {
288288
LLVM_DEBUG(dbgs() << "Too few arguments for function.\n");
289289
return false;
290290
}

llvm/lib/Transforms/Utils/InjectTLIMappings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ static void addMappingsFromTLI(const TargetLibraryInfo &TLI, CallInst &CI) {
9494
const std::string TLIName =
9595
std::string(TLI.getVectorizedFunction(ScalarName, VF));
9696
if (!TLIName.empty()) {
97-
std::string MangledName = VFABI::mangleTLIVectorName(
98-
TLIName, ScalarName, CI.getNumArgOperands(), VF);
97+
std::string MangledName =
98+
VFABI::mangleTLIVectorName(TLIName, ScalarName, CI.arg_size(), VF);
9999
if (!OriginalSetOfMappings.count(MangledName)) {
100100
Mappings.push_back(MangledName);
101101
++NumCallInjected;

llvm/lib/Transforms/Utils/InlineFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2110,7 +2110,7 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
21102110
SmallVector<Value*,4> VarArgsToForward;
21112111
SmallVector<AttributeSet, 4> VarArgsAttrs;
21122112
for (unsigned i = CalledFunc->getFunctionType()->getNumParams();
2113-
i < CB.getNumArgOperands(); i++) {
2113+
i < CB.arg_size(); i++) {
21142114
VarArgsToForward.push_back(CB.getArgOperand(i));
21152115
VarArgsAttrs.push_back(CB.getAttributes().getParamAttrs(i));
21162116
}

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3254,7 +3254,7 @@ bool llvm::canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx) {
32543254
if (CB.isBundleOperand(OpIdx))
32553255
return false;
32563256

3257-
if (OpIdx < CB.getNumArgOperands()) {
3257+
if (OpIdx < CB.arg_size()) {
32583258
// Some variadic intrinsics require constants in the variadic arguments,
32593259
// which currently aren't markable as immarg.
32603260
if (isa<IntrinsicInst>(CB) &&

0 commit comments

Comments
 (0)