[llvm] bba5581 - [Scalar] Use std::optional in LoopFlatten.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 26 00:02:45 PST 2022


Author: Kazu Hirata
Date: 2022-11-26T00:02:40-08:00
New Revision: bba55813fc4e080cd9e4fa7781c611cf41fe7abb

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

LOG: [Scalar] Use std::optional in LoopFlatten.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/Transforms/Scalar/LoopFlatten.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LoopFlatten.cpp b/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
index b116f0a5d32f..ad7a8d28dc5f 100644
--- a/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
@@ -75,6 +75,7 @@
 #include "llvm/Transforms/Utils/LoopUtils.h"
 #include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
 #include "llvm/Transforms/Utils/SimplifyIndVar.h"
+#include <optional>
 
 using namespace llvm;
 using namespace llvm::PatternMatch;
@@ -913,7 +914,7 @@ PreservedAnalyses LoopFlattenPass::run(LoopNest &LN, LoopAnalysisManager &LAM,
 
   bool Changed = false;
 
-  Optional<MemorySSAUpdater> MSSAU;
+  std::optional<MemorySSAUpdater> MSSAU;
   if (AR.MSSA) {
     MSSAU = MemorySSAUpdater(AR.MSSA);
     if (VerifyMemorySSA)
@@ -983,7 +984,7 @@ bool LoopFlattenLegacyPass::runOnFunction(Function &F) {
   auto *AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
   auto *MSSA = getAnalysisIfAvailable<MemorySSAWrapperPass>();
 
-  Optional<MemorySSAUpdater> MSSAU;
+  std::optional<MemorySSAUpdater> MSSAU;
   if (MSSA)
     MSSAU = MemorySSAUpdater(&MSSA->getMSSA());
 


        


More information about the llvm-commits mailing list