[NVPTX] Use std::optional instead of llvm::Optional (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 17 Dec 2022 06:38:57 +0000 (22:38 -0800)
committerKazu Hirata <kazu@google.com>
Sat, 17 Dec 2022 07:04:23 +0000 (23:04 -0800)
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

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
llvm/lib/Target/NVPTX/NVPTXISelLowering.h

index 87b9f92..c7ed379 100644 (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();
index 3c08842..78d8231 100644 (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,