From 87ebd9a36ffb547c18bb3acce2fa90f56d6c5d9d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 25 Feb 2022 09:59:50 +0100 Subject: [PATCH] [IR] Use CallBase::getParamElementType() (NFC) As this method now exists on CallBase, use it rather than the one on AttributeList. --- llvm/include/llvm/IR/Statepoint.h | 3 +-- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 4 ++-- llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp | 2 +- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 2 +- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 2 +- llvm/lib/IR/Verifier.cpp | 10 +++++----- llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/llvm/include/llvm/IR/Statepoint.h b/llvm/include/llvm/IR/Statepoint.h index 8e997d97..ba8ffbb 100644 --- a/llvm/include/llvm/IR/Statepoint.h +++ b/llvm/include/llvm/IR/Statepoint.h @@ -121,8 +121,7 @@ public: /// Return the type of the value returned by the call underlying the /// statepoint. Type *getActualReturnType() const { - auto *FT = cast( - getAttributes().getParamElementType(CalledFunctionPos)); + auto *FT = cast(getParamElementType(CalledFunctionPos)); return FT->getReturnType(); } diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 2547046..dee8c4d 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -4054,7 +4054,7 @@ void BitcodeReader::propagateAttributeTypes(CallBase *CB, if (!CI.hasArg()) continue; - if (CI.isIndirect && !CB->getAttributes().getParamElementType(ArgNo)) { + if (CI.isIndirect && !CB->getParamElementType(ArgNo)) { Type *ElemTy = ArgsTys[ArgNo]->getPointerElementType(); CB->addParamAttr( ArgNo, Attribute::get(Context, Attribute::ElementType, ElemTy)); @@ -4067,7 +4067,7 @@ void BitcodeReader::propagateAttributeTypes(CallBase *CB, switch (CB->getIntrinsicID()) { case Intrinsic::preserve_array_access_index: case Intrinsic::preserve_struct_access_index: - if (!CB->getAttributes().getParamElementType(0)) { + if (!CB->getParamElementType(0)) { Type *ElTy = ArgsTys[0]->getPointerElementType(); Attribute NewAttr = Attribute::get(Context, Attribute::ElementType, ElTy); CB->addParamAttr(0, NewAttr); diff --git a/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp b/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp index e5f95ca..1b66f14 100644 --- a/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp +++ b/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp @@ -310,7 +310,7 @@ bool InlineAsmLowering::lowerInlineAsm( // If this is an indirect operand, the operand is a pointer to the // accessed type. if (OpInfo.isIndirect) { - OpTy = Call.getAttributes().getParamElementType(ArgNo); + OpTy = Call.getParamElementType(ArgNo); assert(OpTy && "Indirect operand must have elementtype attribute"); } diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 8dc6e984..02d57eb 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -8588,7 +8588,7 @@ void SelectionDAGBuilder::visitInlineAsm(const CallBase &Call, if (OpInfo.hasArg()) { OpInfo.CallOperandVal = Call.getArgOperand(ArgNo); OpInfo.CallOperand = getValue(OpInfo.CallOperandVal); - Type *ParamElemTy = Call.getAttributes().getParamElementType(ArgNo); + Type *ParamElemTy = Call.getParamElementType(ArgNo); EVT VT = OpInfo.getCallOperandValEVT(*DAG.getContext(), TLI, DAG.getDataLayout(), ParamElemTy); OpInfo.ConstraintVT = VT.isSimple() ? VT.getSimpleVT() : MVT::Other; diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 5c86129..2168134 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -5021,7 +5021,7 @@ TargetLowering::ParseConstraints(const DataLayout &DL, if (OpInfo.CallOperandVal) { llvm::Type *OpTy = OpInfo.CallOperandVal->getType(); if (OpInfo.isIndirect) { - OpTy = Call.getAttributes().getParamElementType(ArgNo); + OpTy = Call.getParamElementType(ArgNo); assert(OpTy && "Indirect opernad must have elementtype attribute"); } diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 553e6e9..57c2d08 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -2160,7 +2160,7 @@ void Verifier::verifyInlineAsmCall(const CallBase &Call) { "Operand for indirect constraint must have pointer type", &Call); - Assert(Call.getAttributes().getParamElementType(ArgNo), + Assert(Call.getParamElementType(ArgNo), "Operand for indirect constraint must have elementtype attribute", &Call); } else { @@ -2193,7 +2193,7 @@ void Verifier::verifyStatepoint(const CallBase &Call) { "positive", Call); - Type *TargetElemType = Call.getAttributes().getParamElementType(2); + Type *TargetElemType = Call.getParamElementType(2); Assert(TargetElemType, "gc.statepoint callee argument must have elementtype attribute", Call); FunctionType *TargetFuncType = dyn_cast(TargetElemType); @@ -5044,8 +5044,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) { Call.getArgOperand(0)); // Assert that result type matches wrapped callee. - auto *TargetFuncType = cast( - StatepointCall->getAttributes().getParamElementType(2)); + auto *TargetFuncType = + cast(StatepointCall->getParamElementType(2)); Assert(Call.getType() == TargetFuncType->getReturnType(), "gc.result result type does not match wrapped callee", Call); break; @@ -5490,7 +5490,7 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) { } case Intrinsic::preserve_array_access_index: case Intrinsic::preserve_struct_access_index: { - Type *ElemTy = Call.getAttributes().getParamElementType(0); + Type *ElemTy = Call.getParamElementType(0); Assert(ElemTy, "Intrinsic requires elementtype attribute on first argument.", &Call); diff --git a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp index 89e5a91..ee63011 100644 --- a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp +++ b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp @@ -271,7 +271,7 @@ static uint32_t calcArraySize(const DICompositeType *CTy, uint32_t StartDim) { static Type *getBaseElementType(const CallInst *Call) { // Element type is stored in an elementtype() attribute on the first param. - return Call->getAttributes().getParamElementType(0); + return Call->getParamElementType(0); } /// Check whether a call is a preserve_*_access_index intrinsic call or not. -- 2.7.4