[llvm] f0105ee - [GISel] Use std::optional in AArch64PostLegalizerLowering.cpp (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 25 22:20:12 PST 2022
Author: Kazu Hirata
Date: 2022-11-25T22:20:07-08:00
New Revision: f0105ee968b223dffba86b11e1b3dc9e8b3af652
URL: https://github.com/llvm/llvm-project/commit/f0105ee968b223dffba86b11e1b3dc9e8b3af652
DIFF: https://github.com/llvm/llvm-project/commit/f0105ee968b223dffba86b11e1b3dc9e8b3af652.diff
LOG: [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
Added:
Modified:
llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp b/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
index a18291fb48b0..0842462f445b 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 <optional>
#define DEBUG_TYPE "aarch64-postlegalizer-lowering"
@@ -111,8 +112,8 @@ static bool isTRNMask(ArrayRef<int> M, unsigned NumElts,
/// Check if a G_EXT instruction can handle a shuffle mask \p M when the vector
/// sources of the shuffle are
diff erent.
-static Optional<std::pair<bool, uint64_t>> getExtMask(ArrayRef<int> M,
- unsigned NumElts) {
+static std::optional<std::pair<bool, uint64_t>> getExtMask(ArrayRef<int> 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<int> 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<std::pair<bool, int>> isINSMask(ArrayRef<int> M,
- int NumInputElements) {
+static std::optional<std::pair<bool, int>> isINSMask(ArrayRef<int> M,
+ int NumInputElements) {
if (M.size() != static_cast<size_t>(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::pair<uint64_t, CmpInst::Predicate>>
+std::optional<std::pair<uint64_t, CmpInst::Predicate>>
tryAdjustICmpImmAndPred(Register RHS, CmpInst::Predicate P,
- const MachineRegisterInfo &MRI) {
+ const MachineRegisterInfo &MRI) {
const auto &Ty = MRI.getType(RHS);
if (Ty.isVector())
return None;
More information about the llvm-commits
mailing list