[llvm] 2f61c6c - [RISCV] Use std::optional in RISCVISelLowering.cpp (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 25 23:05:03 PST 2022
Author: Kazu Hirata
Date: 2022-11-25T23:04:58-08:00
New Revision: 2f61c6c63953dc0711ec2416ea437d4e31fec9f7
URL: https://github.com/llvm/llvm-project/commit/2f61c6c63953dc0711ec2416ea437d4e31fec9f7
DIFF: https://github.com/llvm/llvm-project/commit/2f61c6c63953dc0711ec2416ea437d4e31fec9f7.diff
LOG: [RISCV] Use std::optional in RISCVISelLowering.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/RISCV/RISCVISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 4cbcb8ddc0ce..00690c2fd9ab 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -39,6 +39,7 @@
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
+#include <optional>
using namespace llvm;
@@ -2158,8 +2159,8 @@ struct VIDSequence {
int64_t Addend;
};
-static Optional<uint64_t> getExactInteger(const APFloat &APF,
- uint32_t BitWidth) {
+static std::optional<uint64_t> getExactInteger(const APFloat &APF,
+ uint32_t BitWidth) {
APSInt ValInt(BitWidth, !APF.isNegative());
// We use an arbitrary rounding mode here. If a floating-point is an exact
// integer (e.g., 1.0), the rounding mode does not affect the output value. If
@@ -2186,14 +2187,14 @@ static Optional<uint64_t> getExactInteger(const APFloat &APF,
// Note that this method will also match potentially unappealing index
// sequences, like <i32 0, i32 50939494>, however it is left to the caller to
// determine whether this is worth generating code for.
-static Optional<VIDSequence> isSimpleVIDSequence(SDValue Op) {
+static std::optional<VIDSequence> isSimpleVIDSequence(SDValue Op) {
unsigned NumElts = Op.getNumOperands();
assert(Op.getOpcode() == ISD::BUILD_VECTOR && "Unexpected BUILD_VECTOR");
bool IsInteger = Op.getValueType().isInteger();
- Optional<unsigned> SeqStepDenom;
- Optional<int64_t> SeqStepNum, SeqAddend;
- Optional<std::pair<uint64_t, unsigned>> PrevElt;
+ std::optional<unsigned> SeqStepDenom;
+ std::optional<int64_t> SeqStepNum, SeqAddend;
+ std::optional<std::pair<uint64_t, unsigned>> PrevElt;
unsigned EltSizeInBits = Op.getValueType().getScalarSizeInBits();
for (unsigned Idx = 0; Idx < NumElts; Idx++) {
// Assume undef elements match the sequence; we just have to be careful
More information about the llvm-commits
mailing list