[llvm] 41c6388 - [Vectorize] Use std::optional in VPlanSLP.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 26 18:11:38 PST 2022


Author: Kazu Hirata
Date: 2022-11-26T18:11:32-08:00
New Revision: 41c638875e28df6d7c893fadda362213d535e6f8

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

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp b/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp
index 0210afa1a0c9..3ac45eaf44eb 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp
@@ -29,6 +29,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cassert>
+#include <optional>
 #include <utility>
 
 using namespace llvm;
@@ -187,7 +188,7 @@ getOperands(ArrayRef<VPValue *> Values) {
 }
 
 /// Returns the opcode of Values or ~0 if they do not all agree.
-static Optional<unsigned> getOpcode(ArrayRef<VPValue *> Values) {
+static std::optional<unsigned> getOpcode(ArrayRef<VPValue *> Values) {
   unsigned Opcode = cast<VPInstruction>(Values[0])->getOpcode();
   if (any_of(Values, [Opcode](VPValue *V) {
         return cast<VPInstruction>(V)->getOpcode() != Opcode;


        


More information about the llvm-commits mailing list