@@ -1188,7 +1188,7 @@ NVPTXTargetLowering::LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const {
11881188std::string NVPTXTargetLowering::getPrototype (
11891189 const DataLayout &DL, Type *retTy, const ArgListTy &Args,
11901190 const SmallVectorImpl<ISD::OutputArg> &Outs, MaybeAlign RetAlign,
1191- std::optional<std::pair< unsigned , unsigned >> VAInfo , const CallBase &CB,
1191+ std::optional<unsigned > FirstVAArg , const CallBase &CB,
11921192 unsigned UniqueCallSite) const {
11931193 auto PtrVT = getPointerTy (DL);
11941194
@@ -1230,7 +1230,7 @@ std::string NVPTXTargetLowering::getPrototype(
12301230
12311231 bool first = true ;
12321232
1233- const unsigned NumArgs = VAInfo ? VAInfo-> first : Args.size ();
1233+ const unsigned NumArgs = FirstVAArg. value_or ( Args.size () );
12341234 auto AllOuts = ArrayRef (Outs);
12351235 for (const unsigned I : llvm::seq (NumArgs)) {
12361236 const auto ArgOuts =
@@ -1278,9 +1278,9 @@ std::string NVPTXTargetLowering::getPrototype(
12781278 }
12791279 }
12801280
1281- if (VAInfo )
1282- O << (first ? " " : " ," ) << " .param .align " << VAInfo-> second
1283- << " .b8 _[]\n " ;
1281+ if (FirstVAArg )
1282+ O << (first ? " " : " ," ) << " .param .align "
1283+ << STI. getMaxRequiredAlignment () << " .b8 _[]\n " ;
12841284 O << " )" ;
12851285 if (shouldEmitPTXNoReturn (&CB, *nvTM))
12861286 O << " .noreturn" ;
@@ -1782,13 +1782,10 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
17821782 // instruction.
17831783 // The prototype is embedded in a string and put as the operand for a
17841784 // CallPrototype SDNode which will print out to the value of the string.
1785- std::string Proto = getPrototype (
1786- DL, RetTy, Args, CLI.Outs , RetAlign,
1787- HasVAArgs
1788- ? std::optional (std::pair (CLI.NumFixedArgs ,
1789- VADeclareParam.getConstantOperandVal (1 )))
1790- : std::nullopt ,
1791- *CB, UniqueCallSite);
1785+ std::string Proto =
1786+ getPrototype (DL, RetTy, Args, CLI.Outs , RetAlign,
1787+ HasVAArgs ? std::optional (FirstVAArg) : std::nullopt , *CB,
1788+ UniqueCallSite);
17921789 const char *ProtoStr = nvTM->getStrPool ().save (Proto).data ();
17931790 SDValue ProtoOps[] = {
17941791 Chain,
0 commit comments