[llvm] af0d385 - [GlobalISel] Use std::optional in Utils.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 26 14:47:52 PST 2022


Author: Kazu Hirata
Date: 2022-11-26T14:47:46-08:00
New Revision: af0d3856936ae2c2c52747a796519b7849873661

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

LOG: [GlobalISel] Use std::optional in Utils.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/CodeGen/GlobalISel/Utils.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/GlobalISel/Utils.cpp b/llvm/lib/CodeGen/GlobalISel/Utils.cpp
index 92368ab9beb7..1809240f01bd 100644
--- a/llvm/lib/CodeGen/GlobalISel/Utils.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/Utils.cpp
@@ -34,6 +34,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Transforms/Utils/SizeOpts.h"
 #include <numeric>
+#include <optional>
 
 #define DEBUG_TYPE "globalisel-utils"
 
@@ -792,7 +793,7 @@ Optional<SmallVector<unsigned>>
 llvm::ConstantFoldCTLZ(Register Src, const MachineRegisterInfo &MRI) {
   LLT Ty = MRI.getType(Src);
   SmallVector<unsigned> FoldedCTLZs;
-  auto tryFoldScalar = [&](Register R) -> Optional<unsigned> {
+  auto tryFoldScalar = [&](Register R) -> std::optional<unsigned> {
     auto MaybeCst = getIConstantVRegVal(R, MRI);
     if (!MaybeCst)
       return None;


        


More information about the llvm-commits mailing list