[Vectorize] Use std::optional in VPlanSLP.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 27 Nov 2022 02:11:32 +0000 (18:11 -0800)
committerKazu Hirata <kazu@google.com>
Sun, 27 Nov 2022 02:11:32 +0000 (18:11 -0800)
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

llvm/lib/Transforms/Vectorize/VPlanSLP.cpp

index 0210afa..3ac45ea 100644 (file)
@@ -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;