Skip to content

Commit 4b77338

Browse files
committed
address comments
1 parent 0e16e73 commit 4b77338

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ NVPTXTargetLowering::LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const {
11881188
std::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,

llvm/lib/Target/NVPTX/NVPTXISelLowering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class NVPTXTargetLowering : public TargetLowering {
196196
std::string getPrototype(const DataLayout &DL, Type *, const ArgListTy &,
197197
const SmallVectorImpl<ISD::OutputArg> &,
198198
MaybeAlign RetAlign,
199-
std::optional<std::pair<unsigned, unsigned>> VAInfo,
199+
std::optional<unsigned> FirstVAArg,
200200
const CallBase &CB, unsigned UniqueCallSite) const;
201201

202202
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,

0 commit comments

Comments
 (0)