[NVPTX] Use std::optional instead of llvm::Optional (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
This commit is contained in:
Kazu Hirata
2022-12-16 22:38:57 -08:00
parent da7415acda
commit 85956bd552
2 changed files with 13 additions and 12 deletions

View File

@@ -1318,8 +1318,8 @@ NVPTXTargetLowering::LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const {
std::string NVPTXTargetLowering::getPrototype(
const DataLayout &DL, Type *retTy, const ArgListTy &Args,
const SmallVectorImpl<ISD::OutputArg> &Outs, MaybeAlign retAlignment,
Optional<std::pair<unsigned, const APInt &>> VAInfo, const CallBase &CB,
unsigned UniqueCallSite) const {
std::optional<std::pair<unsigned, const APInt &>> VAInfo,
const CallBase &CB, unsigned UniqueCallSite) const {
auto PtrVT = getPointerTy(DL);
bool isABI = (STI.getSmVersion() >= 20);
@@ -1812,11 +1812,12 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
SDVTList ProtoVTs = DAG.getVTList(MVT::Other, MVT::Glue);
std::string Proto = getPrototype(
DL, RetTy, Args, Outs, retAlignment,
HasVAArgs ? Optional<std::pair<unsigned, const APInt &>>(std::make_pair(
CLI.NumFixedArgs,
cast<ConstantSDNode>(VADeclareParam->getOperand(1))
->getAPIntValue()))
: std::nullopt,
HasVAArgs
? std::optional<std::pair<unsigned, const APInt &>>(std::make_pair(
CLI.NumFixedArgs,
cast<ConstantSDNode>(VADeclareParam->getOperand(1))
->getAPIntValue()))
: std::nullopt,
*CB, UniqueCallSite);
const char *ProtoStr =
nvTM->getManagedStrPool()->getManagedString(Proto.c_str())->c_str();

View File

@@ -499,11 +499,11 @@ public:
SDValue LowerCall(CallLoweringInfo &CLI,
SmallVectorImpl<SDValue> &InVals) const override;
std::string getPrototype(const DataLayout &DL, Type *, const ArgListTy &,
const SmallVectorImpl<ISD::OutputArg> &,
MaybeAlign retAlignment,
Optional<std::pair<unsigned, const APInt &>> VAInfo,
const CallBase &CB, unsigned UniqueCallSite) const;
std::string
getPrototype(const DataLayout &DL, Type *, const ArgListTy &,
const SmallVectorImpl<ISD::OutputArg> &, MaybeAlign retAlignment,
std::optional<std::pair<unsigned, const APInt &>> VAInfo,
const CallBase &CB, unsigned UniqueCallSite) const;
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
const SmallVectorImpl<ISD::OutputArg> &Outs,