[llvm] 6ccf1d2 - [SelectionDAG] Teach getRegistersForValue to return std::optional (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 19 15:00:26 PST 2022
Author: Kazu Hirata
Date: 2022-11-19T15:00:19-08:00
New Revision: 6ccf1d23d7a503e1b50a8acb5aa5403a311d3446
URL: https://github.com/llvm/llvm-project/commit/6ccf1d23d7a503e1b50a8acb5aa5403a311d3446
DIFF: https://github.com/llvm/llvm-project/commit/6ccf1d23d7a503e1b50a8acb5aa5403a311d3446.diff
LOG: [SelectionDAG] Teach getRegistersForValue to return std::optional (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/11
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index fe7d6b363e7a..bfdc2ec84d89 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -100,6 +100,7 @@
#include <cstddef>
#include <iterator>
#include <limits>
+#include <optional>
#include <tuple>
using namespace llvm;
@@ -8599,7 +8600,7 @@ static SDValue getAddressForMemoryInput(SDValue Chain, const SDLoc &Location,
///
/// OpInfo describes the operand
/// RefOpInfo describes the matching operand if any, the operand otherwise
-static llvm::Optional<unsigned>
+static std::optional<unsigned>
getRegistersForValue(SelectionDAG &DAG, const SDLoc &DL,
SDISelAsmOperandInfo &OpInfo,
SDISelAsmOperandInfo &RefOpInfo) {
@@ -8613,7 +8614,7 @@ getRegistersForValue(SelectionDAG &DAG, const SDLoc &DL,
// No work to do for memory/address operands.
if (OpInfo.ConstraintType == TargetLowering::C_Memory ||
OpInfo.ConstraintType == TargetLowering::C_Address)
- return None;
+ return std::nullopt;
// If this is a constraint for a single physreg, or a constraint for a
// register class, find it.
@@ -8623,7 +8624,7 @@ getRegistersForValue(SelectionDAG &DAG, const SDLoc &DL,
&TRI, RefOpInfo.ConstraintCode, RefOpInfo.ConstraintVT);
// RC is unset only on failure. Return immediately.
if (!RC)
- return None;
+ return std::nullopt;
// Get the actual register value type. This is important, because the user
// may have asked for (e.g.) the AX register in i32 type. We need to
@@ -8668,7 +8669,7 @@ getRegistersForValue(SelectionDAG &DAG, const SDLoc &DL,
// No need to allocate a matching input constraint since the constraint it's
// matching to has already been allocated.
if (OpInfo.isMatchingInputConstraint())
- return None;
+ return std::nullopt;
EVT ValueVT = OpInfo.ConstraintVT;
if (OpInfo.ConstraintVT == MVT::Other)
@@ -8706,7 +8707,7 @@ getRegistersForValue(SelectionDAG &DAG, const SDLoc &DL,
}
OpInfo.AssignedRegs = RegsForValue(Regs, RegVT, ValueVT);
- return None;
+ return std::nullopt;
}
static unsigned
More information about the llvm-commits
mailing list