Skip to content

Commit f631173

Browse files
[llvm] Migrate from arg_operands to args (NFC)
Note that arg_operands is considered a legacy name. See llvm/include/llvm/IR/InstrTypes.h for details.
1 parent cf362ff commit f631173

17 files changed

+24
-24
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5096,7 +5096,7 @@ static bool directlyImpliesPoison(const Value *ValAssumedPoison,
50965096
const WithOverflowInst *II;
50975097
if (match(I, m_ExtractValue(m_WithOverflowInst(II))) &&
50985098
(match(ValAssumedPoison, m_ExtractValue(m_Specific(II))) ||
5099-
llvm::is_contained(II->arg_operands(), ValAssumedPoison)))
5099+
llvm::is_contained(II->args(), ValAssumedPoison)))
51005100
return true;
51015101
}
51025102
return false;

llvm/lib/CodeGen/CodeGenPrepare.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,7 +2107,7 @@ bool CodeGenPrepare::optimizeCallInst(CallInst *CI, bool &ModifiedDT) {
21072107
// idea
21082108
unsigned MinSize, PrefAlign;
21092109
if (TLI->shouldAlignPointerArgs(CI, MinSize, PrefAlign)) {
2110-
for (auto &Arg : CI->arg_operands()) {
2110+
for (auto &Arg : CI->args()) {
21112111
// We want to align both objects whose address is used directly and
21122112
// objects whose address is used in casts and GEPs, though it only makes
21132113
// sense for GEPs if the offset is a multiple of the desired alignment and
@@ -2158,7 +2158,7 @@ bool CodeGenPrepare::optimizeCallInst(CallInst *CI, bool &ModifiedDT) {
21582158
// into their uses. TODO: generalize this to work over profiling data
21592159
if (CI->hasFnAttr(Attribute::Cold) &&
21602160
!OptSize && !llvm::shouldOptimizeForSize(BB, PSI, BFI.get()))
2161-
for (auto &Arg : CI->arg_operands()) {
2161+
for (auto &Arg : CI->args()) {
21622162
if (!Arg->getType()->isPointerTy())
21632163
continue;
21642164
unsigned AS = Arg->getType()->getPointerAddressSpace();

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,7 +1784,7 @@ bool IRTranslator::translateSimpleIntrinsic(const CallInst &CI,
17841784

17851785
// Yes. Let's translate it.
17861786
SmallVector<llvm::SrcOp, 4> VRegs;
1787-
for (auto &Arg : CI.arg_operands())
1787+
for (auto &Arg : CI.args())
17881788
VRegs.push_back(getOrCreateVReg(*Arg));
17891789

17901790
MIRBuilder.buildInstr(Op, {getOrCreateVReg(CI)}, VRegs,
@@ -2372,7 +2372,7 @@ bool IRTranslator::translateCall(const User &U, MachineIRBuilder &MIRBuilder) {
23722372
if (isa<FPMathOperator>(CI))
23732373
MIB->copyIRFlags(CI);
23742374

2375-
for (auto &Arg : enumerate(CI.arg_operands())) {
2375+
for (auto &Arg : enumerate(CI.args())) {
23762376
// If this is required to be an immediate, don't materialize it in a
23772377
// register.
23782378
if (CI.paramHasAttr(Arg.index(), Attribute::ImmArg)) {

llvm/lib/CodeGen/ReplaceWithVeclib.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static bool replaceWithTLIFunction(CallInst &CI, const StringRef TLIName) {
7070
// Replace the call to the vector intrinsic with a call
7171
// to the corresponding function from the vector library.
7272
IRBuilder<> IRBuilder(&CI);
73-
SmallVector<Value *> Args(CI.arg_operands());
73+
SmallVector<Value *> Args(CI.args());
7474
// Preserve the operand bundles.
7575
SmallVector<OperandBundleDef, 1> OpBundles;
7676
CI.getOperandBundlesAsDefs(OpBundles);
@@ -106,7 +106,7 @@ static bool replaceWithCallToVeclib(const TargetLibraryInfo &TLI,
106106
// all vector operands have identical vector width.
107107
ElementCount VF = ElementCount::getFixed(0);
108108
SmallVector<Type *> ScalarTypes;
109-
for (auto Arg : enumerate(CI.arg_operands())) {
109+
for (auto Arg : enumerate(CI.args())) {
110110
auto *ArgType = Arg.value()->getType();
111111
// Vector calls to intrinsics can still have
112112
// scalar operands for specific arguments.

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3707,7 +3707,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
37073707
assert((OperandWidth == 64 || OperandWidth == 128) &&
37083708
"Unexpected operand width");
37093709
Type *NewTy = FixedVectorType::get(Type::getBFloatTy(C), OperandWidth / 16);
3710-
auto Iter = CI->arg_operands().begin();
3710+
auto Iter = CI->args().begin();
37113711
Args.push_back(*Iter++);
37123712
Args.push_back(Builder.CreateBitCast(*Iter++, NewTy));
37133713
Args.push_back(Builder.CreateBitCast(*Iter++, NewTy));

llvm/lib/Target/AArch64/AArch64FastISel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3536,7 +3536,7 @@ bool AArch64FastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) {
35363536
Args.reserve(II->getNumArgOperands());
35373537

35383538
// Populate the argument list.
3539-
for (auto &Arg : II->arg_operands()) {
3539+
for (auto &Arg : II->args()) {
35403540
ArgListEntry Entry;
35413541
Entry.Val = Arg;
35423542
Entry.Ty = Arg->getType();

llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ simplifyAMDGCNImageIntrinsic(const GCNSubtarget *ST,
148148
Function *I =
149149
Intrinsic::getDeclaration(II.getModule(), II.getIntrinsicID(), ArgTys);
150150

151-
SmallVector<Value *, 8> Args(II.arg_operands());
151+
SmallVector<Value *, 8> Args(II.args());
152152

153153
unsigned EndIndex =
154154
OnlyDerivatives ? ImageDimIntr->CoordStart : ImageDimIntr->VAddrEnd;

llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static Instruction *simplifyNvvmIntrinsic(IntrinsicInst *II, InstCombiner &IC) {
328328

329329
// Simplify to target-generic intrinsic.
330330
if (Action.IID) {
331-
SmallVector<Value *, 4> Args(II->arg_operands());
331+
SmallVector<Value *, 4> Args(II->args());
332332
// All the target-generic intrinsics currently of interest to us have one
333333
// type argument, equal to that of the nvvm intrinsic's argument.
334334
Type *Tys[] = {II->getArgOperand(0)->getType()};

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2819,7 +2819,7 @@ void AddressSanitizer::markEscapedLocalAllocas(Function &F) {
28192819
IntrinsicInst *II = dyn_cast<IntrinsicInst>(&I);
28202820
if (II && II->getIntrinsicID() == Intrinsic::localescape) {
28212821
// We found a call. Mark all the allocas passed in as uninteresting.
2822-
for (Value *Arg : II->arg_operands()) {
2822+
for (Value *Arg : II->args()) {
28232823
AllocaInst *AI = dyn_cast<AllocaInst>(Arg->stripPointerCasts());
28242824
assert(AI && AI->isStaticAlloca() &&
28252825
"non-static alloca arg to localescape");

llvm/lib/Transforms/Scalar/LICM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ bool llvm::canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
12401240
// writes to this memory in the loop, we can hoist or sink.
12411241
if (AAResults::onlyAccessesArgPointees(Behavior)) {
12421242
// TODO: expand to writeable arguments
1243-
for (Value *Op : CI->arg_operands())
1243+
for (Value *Op : CI->args())
12441244
if (Op->getType()->isPointerTy()) {
12451245
bool Invalidated;
12461246
if (CurAST)

llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT,
931931
if (II) {
932932
// The scalarization code below does not work for scalable vectors.
933933
if (isa<ScalableVectorType>(II->getType()) ||
934-
any_of(II->arg_operands(),
934+
any_of(II->args(),
935935
[](Value *V) { return isa<ScalableVectorType>(V->getType()); }))
936936
return false;
937937

llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static bool markTails(Function &F, OptimizationRemarkEmitter *ORE) {
262262
// Note that this runs whether we know an alloca has escaped or not. If
263263
// it has, then we can't trust Tracker.AllocaUsers to be accurate.
264264
bool SafeToTail = true;
265-
for (auto &Arg : CI->arg_operands()) {
265+
for (auto &Arg : CI->args()) {
266266
if (isa<Constant>(Arg.getUser()))
267267
continue;
268268
if (Argument *A = dyn_cast<Argument>(Arg.getUser()))

llvm/lib/Transforms/Utils/InjectTLIMappings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static void addVariantDeclaration(CallInst &CI, const ElementCount &VF,
4747
// Add function declaration.
4848
Type *RetTy = ToVectorTy(CI.getType(), VF);
4949
SmallVector<Type *, 4> Tys;
50-
for (Value *ArgOperand : CI.arg_operands())
50+
for (Value *ArgOperand : CI.args())
5151
Tys.push_back(ToVectorTy(ArgOperand->getType(), VF));
5252
assert(!CI.getFunctionType()->isVarArg() &&
5353
"VarArg functions are not supported.");

llvm/lib/Transforms/Utils/InlineFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2152,7 +2152,7 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
21522152
Attrs = AttributeList::get(CI->getContext(), Attrs.getFnAttrs(),
21532153
Attrs.getRetAttrs(), ArgAttrs);
21542154
// Add VarArgs to existing parameters.
2155-
SmallVector<Value *, 6> Params(CI->arg_operands());
2155+
SmallVector<Value *, 6> Params(CI->args());
21562156
Params.append(VarArgsToForward.begin(), VarArgsToForward.end());
21572157
CallInst *NewCI = CallInst::Create(
21582158
CI->getFunctionType(), CI->getCalledOperand(), Params, "", CI);

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3893,7 +3893,7 @@ LoopVectorizationCostModel::getVectorCallCost(CallInst *CI, ElementCount VF,
38933893
Function *F = CI->getCalledFunction();
38943894
Type *ScalarRetTy = CI->getType();
38953895
SmallVector<Type *, 4> Tys, ScalarTys;
3896-
for (auto &ArgOp : CI->arg_operands())
3896+
for (auto &ArgOp : CI->args())
38973897
ScalarTys.push_back(ArgOp->getType());
38983898

38993899
// Estimate cost of scalarized vector call. The source operands are assumed
@@ -4979,7 +4979,7 @@ void InnerLoopVectorizer::widenCallInstruction(CallInst &I, VPValue *Def,
49794979
auto *CI = cast<CallInst>(&I);
49804980

49814981
SmallVector<Type *, 4> Tys;
4982-
for (Value *ArgOperand : CI->arg_operands())
4982+
for (Value *ArgOperand : CI->args())
49834983
Tys.push_back(ToVectorTy(ArgOperand->getType(), VF.getKnownMinValue()));
49844984

49854985
Intrinsic::ID ID = getVectorIntrinsicIDForCall(CI, TLI);
@@ -7418,7 +7418,7 @@ LoopVectorizationCostModel::getScalarizationOverhead(Instruction *I,
74187418

74197419
// Collect operands to consider.
74207420
CallInst *CI = dyn_cast<CallInst>(I);
7421-
Instruction::op_range Ops = CI ? CI->arg_operands() : I->operands();
7421+
Instruction::op_range Ops = CI ? CI->args() : I->operands();
74227422

74237423
// Skip operands that do not require extraction/scalarization and do not incur
74247424
// any overhead.

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ void VPlanTransforms::VPInstructionsToVPRecipes(
7171
NewRecipe = new VPWidenGEPRecipe(
7272
GEP, Plan->mapToVPValues(GEP->operands()), OrigLoop);
7373
} else if (CallInst *CI = dyn_cast<CallInst>(Inst)) {
74-
NewRecipe = new VPWidenCallRecipe(
75-
*CI, Plan->mapToVPValues(CI->arg_operands()));
74+
NewRecipe =
75+
new VPWidenCallRecipe(*CI, Plan->mapToVPValues(CI->args()));
7676
} else if (SelectInst *SI = dyn_cast<SelectInst>(Inst)) {
7777
bool InvariantCond =
7878
SE.isLoopInvariant(SE.getSCEV(SI->getOperand(0)), OrigLoop);

llvm/unittests/IR/InstructionsTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ TEST_F(ModuleWithFunctionTest, CallInst) {
8989

9090
// Make sure iteration over a call's arguments works as expected.
9191
unsigned Idx = 0;
92-
for (Value *Arg : Call->arg_operands()) {
92+
for (Value *Arg : Call->args()) {
9393
EXPECT_EQ(FArgTypes[Idx], Arg->getType());
9494
EXPECT_EQ(Call->getArgOperand(Idx)->getType(), Arg->getType());
9595
Idx++;
@@ -111,7 +111,7 @@ TEST_F(ModuleWithFunctionTest, InvokeInst) {
111111

112112
// Make sure iteration over invoke's arguments works as expected.
113113
unsigned Idx = 0;
114-
for (Value *Arg : Invoke->arg_operands()) {
114+
for (Value *Arg : Invoke->args()) {
115115
EXPECT_EQ(FArgTypes[Idx], Arg->getType());
116116
EXPECT_EQ(Invoke->getArgOperand(Idx)->getType(), Arg->getType());
117117
Idx++;

0 commit comments

Comments
 (0)