[llvm] 1b9ca45 - [MemProf] llvm::Optional => std::optional

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 00:16:02 PST 2022


Author: Fangrui Song
Date: 2022-12-13T08:15:56Z
New Revision: 1b9ca45a900478ad6f4275a69f22775ed10877d5

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

LOG: [MemProf] llvm::Optional => std::optional

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/MemProfiler.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index 6d39c6d043e4..2a1601fab45f 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -172,7 +172,7 @@ class MemProfiler {
   /// If it is an interesting memory access, populate information
   /// about the access and return a InterestingMemoryAccess struct.
   /// Otherwise return std::nullopt.
-  Optional<InterestingMemoryAccess>
+  std::optional<InterestingMemoryAccess>
   isInterestingMemoryAccess(Instruction *I) const;
 
   void instrumentMop(Instruction *I, const DataLayout &DL,
@@ -267,7 +267,7 @@ void MemProfiler::instrumentMemIntrinsic(MemIntrinsic *MI) {
   MI->eraseFromParent();
 }
 
-Optional<InterestingMemoryAccess>
+std::optional<InterestingMemoryAccess>
 MemProfiler::isInterestingMemoryAccess(Instruction *I) const {
   // Do not instrument the load fetching the dynamic shadow address.
   if (DynamicShadowOffset == I)
@@ -585,7 +585,7 @@ bool MemProfiler::instrumentFunction(Function &F) {
   for (auto *Inst : ToInstrument) {
     if (ClDebugMin < 0 || ClDebugMax < 0 ||
         (NumInstrumented >= ClDebugMin && NumInstrumented <= ClDebugMax)) {
-      Optional<InterestingMemoryAccess> Access =
+      std::optional<InterestingMemoryAccess> Access =
           isInterestingMemoryAccess(Inst);
       if (Access)
         instrumentMop(Inst, F.getParent()->getDataLayout(), *Access);


        


More information about the llvm-commits mailing list