[llvm] dd698b7 - [SelectionDAG] Use std::optional in DAGCombiner.cpp (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 26 15:00:29 PST 2022
Author: Kazu Hirata
Date: 2022-11-26T15:00:23-08:00
New Revision: dd698b7777e11be5c11e59898dfd77765a0e9bc9
URL: https://github.com/llvm/llvm-project/commit/dd698b7777e11be5c11e59898dfd77765a0e9bc9
DIFF: https://github.com/llvm/llvm-project/commit/dd698b7777e11be5c11e59898dfd77765a0e9bc9.diff
LOG: [SelectionDAG] Use std::optional in DAGCombiner.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/CodeGen/SelectionDAG/DAGCombiner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 85a92d51d3b37..fd1259b693bc0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -69,6 +69,7 @@
#include <cstdint>
#include <functional>
#include <iterator>
+#include <optional>
#include <string>
#include <tuple>
#include <utility>
@@ -7914,7 +7915,7 @@ struct ByteProvider {
/// *ExtractVectorElement
static const Optional<ByteProvider>
calculateByteProvider(SDValue Op, unsigned Index, unsigned Depth,
- Optional<uint64_t> VectorIndex,
+ std::optional<uint64_t> VectorIndex,
unsigned StartingIndex = 0) {
// Typical i64 by i8 pattern requires recursion up to 8 calls depth
@@ -8160,7 +8161,7 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) {
SmallVector<int64_t, 8> OffsetMap(NumStores, INT64_MAX);
int64_t FirstOffset = INT64_MAX;
StoreSDNode *FirstStore = nullptr;
- Optional<BaseIndexOffset> Base;
+ std::optional<BaseIndexOffset> Base;
for (auto *Store : Stores) {
// All the stores store
diff erent parts of the CombinedValue. A truncate is
// required to get the partial value.
@@ -8342,7 +8343,7 @@ SDValue DAGCombiner::MatchLoadCombine(SDNode *N) {
: littleEndianByteAt(LoadByteWidth, P.ByteOffset);
};
- Optional<BaseIndexOffset> Base;
+ std::optional<BaseIndexOffset> Base;
SDValue Chain;
SmallPtrSet<LoadSDNode *, 8> Loads;
@@ -18308,7 +18309,7 @@ bool DAGCombiner::mergeStoresOfConstantsOrVecElts(
unsigned SizeInBits = NumStores * ElementSizeBits;
unsigned NumMemElts = MemVT.isVector() ? MemVT.getVectorNumElements() : 1;
- Optional<MachineMemOperand::Flags> Flags;
+ std::optional<MachineMemOperand::Flags> Flags;
AAMDNodes AAInfo;
for (unsigned I = 0; I != NumStores; ++I) {
StoreSDNode *St = cast<StoreSDNode>(StoreNodes[I].MemNode);
More information about the llvm-commits
mailing list