[llvm] da4dd0a - [NVPTX] Use std::optional in NVPTXTargetTransformInfo.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 22:54:46 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T22:54:42-08:00
New Revision: da4dd0aaf3fa832038ad2ae3ca4b40782f345809

URL: https://github.com/llvm/llvm-project/commit/da4dd0aaf3fa832038ad2ae3ca4b40782f345809
DIFF: https://github.com/llvm/llvm-project/commit/da4dd0aaf3fa832038ad2ae3ca4b40782f345809.diff

LOG: [NVPTX] Use std::optional in NVPTXTargetTransformInfo.cpp (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

Added: 
    

Modified: 
    llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp b/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
index de299f1b634ae..ec4a55dd39a94 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
@@ -16,6 +16,7 @@
 #include "llvm/CodeGen/TargetLowering.h"
 #include "llvm/IR/IntrinsicsNVPTX.h"
 #include "llvm/Support/Debug.h"
+#include <optional>
 using namespace llvm;
 
 #define DEBUG_TYPE "NVPTXtti"
@@ -139,10 +140,10 @@ static Instruction *simplifyNvvmIntrinsic(IntrinsicInst *II, InstCombiner &IC) {
   // represents how to replace an NVVM intrinsic with target-generic LLVM IR.
   struct SimplifyAction {
     // Invariant: At most one of these Optionals has a value.
-    Optional<Intrinsic::ID> IID;
-    Optional<Instruction::CastOps> CastOp;
-    Optional<Instruction::BinaryOps> BinaryOp;
-    Optional<SpecialCase> Special;
+    std::optional<Intrinsic::ID> IID;
+    std::optional<Instruction::CastOps> CastOp;
+    std::optional<Instruction::BinaryOps> BinaryOp;
+    std::optional<SpecialCase> Special;
 
     FtzRequirementTy FtzRequirement = FTZ_Any;
     // Denormal handling is guarded by 
diff erent attributes depending on the


        


More information about the llvm-commits mailing list