[llvm] 27ae235 - [Scalar] Use std::optional in LoopRotation.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 26 17:21:24 PST 2022


Author: Kazu Hirata
Date: 2022-11-26T17:21:19-08:00
New Revision: 27ae2354a055a84bf95e958a66b1cbbbb1ff1280

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

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp
index c9c938be0fff..ba735adc5b27 100644
--- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp
@@ -25,6 +25,7 @@
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/LoopRotationUtils.h"
 #include "llvm/Transforms/Utils/LoopUtils.h"
+#include <optional>
 using namespace llvm;
 
 #define DEBUG_TYPE "loop-rotate"
@@ -55,7 +56,7 @@ PreservedAnalyses LoopRotatePass::run(Loop &L, LoopAnalysisManager &AM,
   const DataLayout &DL = L.getHeader()->getModule()->getDataLayout();
   const SimplifyQuery SQ = getBestSimplifyQuery(AR, DL);
 
-  Optional<MemorySSAUpdater> MSSAU;
+  std::optional<MemorySSAUpdater> MSSAU;
   if (AR.MSSA)
     MSSAU = MemorySSAUpdater(AR.MSSA);
   bool Changed = LoopRotation(&L, &AR.LI, &AR.TTI, &AR.AC, &AR.DT, &AR.SE,
@@ -116,7 +117,7 @@ class LoopRotateLegacyPass : public LoopPass {
     auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
     auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE();
     const SimplifyQuery SQ = getBestSimplifyQuery(*this, F);
-    Optional<MemorySSAUpdater> MSSAU;
+    std::optional<MemorySSAUpdater> MSSAU;
     // Not requiring MemorySSA and getting it only if available will split
     // the loop pass pipeline when LoopRotate is being run first.
     auto *MSSAA = getAnalysisIfAvailable<MemorySSAWrapperPass>();


        


More information about the llvm-commits mailing list