From f0105ee968b223dffba86b11e1b3dc9e8b3af652 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 25 Nov 2022 22:20:07 -0800 Subject: [PATCH] [GISel] Use std::optional in AArch64PostLegalizerLowering.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 --- .../Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp b/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp index a18291f..0842462 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp @@ -44,6 +44,7 @@ #include "llvm/InitializePasses.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" +#include #define DEBUG_TYPE "aarch64-postlegalizer-lowering" @@ -111,8 +112,8 @@ static bool isTRNMask(ArrayRef M, unsigned NumElts, /// Check if a G_EXT instruction can handle a shuffle mask \p M when the vector /// sources of the shuffle are different. -static Optional> getExtMask(ArrayRef M, - unsigned NumElts) { +static std::optional> getExtMask(ArrayRef M, + unsigned NumElts) { // Look for the first non-undef element. auto FirstRealElt = find_if(M, [](int Elt) { return Elt >= 0; }); if (FirstRealElt == M.end()) @@ -193,8 +194,8 @@ static bool isZipMask(ArrayRef M, unsigned NumElts, /// G_INSERT_VECTOR_ELT destination should be the LHS of the G_SHUFFLE_VECTOR. /// /// Second element is the destination lane for the G_INSERT_VECTOR_ELT. -static Optional> isINSMask(ArrayRef M, - int NumInputElements) { +static std::optional> isINSMask(ArrayRef M, + int NumInputElements) { if (M.size() != static_cast(NumInputElements)) return None; int NumLHSMatch = 0, NumRHSMatch = 0; @@ -557,9 +558,9 @@ static bool applyVAshrLshrImm(MachineInstr &MI, MachineRegisterInfo &MRI, /// be used to optimize the instruction. /// /// \note This assumes that the comparison has been legalized. -Optional> +std::optional> tryAdjustICmpImmAndPred(Register RHS, CmpInst::Predicate P, - const MachineRegisterInfo &MRI) { + const MachineRegisterInfo &MRI) { const auto &Ty = MRI.getType(RHS); if (Ty.isVector()) return None; -- 2.7.4