[llvm] b12aa49 - [DAGCombine] Replace std::monostate equivalent in DAGCombiner.cpp
Joe Loser via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 12 20:43:47 PDT 2022
Author: Joe Loser
Date: 2022-08-12T21:42:09-06:00
New Revision: b12aa497cdc10ff195cba8a9165e0589163ccfc4
URL: https://github.com/llvm/llvm-project/commit/b12aa497cdc10ff195cba8a9165e0589163ccfc4
DIFF: https://github.com/llvm/llvm-project/commit/b12aa497cdc10ff195cba8a9165e0589163ccfc4.diff
LOG: [DAGCombine] Replace std::monostate equivalent in DAGCombiner.cpp
Remove the `UnitT` type and operators in favor of using `std::monostate`
directly.
Differential Revision: https://reviews.llvm.org/D131778
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 d396f5f130a9c..11bde5bff832f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -72,6 +72,7 @@
#include <string>
#include <tuple>
#include <utility>
+#include <variant>
using namespace llvm;
@@ -24943,13 +24944,6 @@ SDValue DAGCombiner::FindBetterChain(SDNode *N, SDValue OldChain) {
return DAG.getTokenFactor(SDLoc(N), Aliases);
}
-namespace {
-// TODO: Replace with with std::monostate when we move to C++17.
-struct UnitT { } Unit;
-bool operator==(const UnitT &, const UnitT &) { return true; }
-bool operator!=(const UnitT &, const UnitT &) { return false; }
-} // namespace
-
// This function tries to collect a bunch of potentially interesting
// nodes to improve the chains of, all at once. This might seem
// redundant, as this function gets called when visiting every store
@@ -24970,8 +24964,8 @@ bool DAGCombiner::parallelizeChainedStores(StoreSDNode *St) {
// the common case, every store writes to the immediately previous address
// space and thus merged with the previous interval at insertion time.
- using IMap =
- llvm::IntervalMap<int64_t, UnitT, 8, IntervalMapHalfOpenInfo<int64_t>>;
+ using IMap = llvm::IntervalMap<int64_t, std::monostate, 8,
+ IntervalMapHalfOpenInfo<int64_t>>;
IMap::Allocator A;
IMap Intervals(A);
@@ -24998,7 +24992,8 @@ bool DAGCombiner::parallelizeChainedStores(StoreSDNode *St) {
return false;
// Add ST's interval.
- Intervals.insert(0, (St->getMemoryVT().getSizeInBits() + 7) / 8, Unit);
+ Intervals.insert(0, (St->getMemoryVT().getSizeInBits() + 7) / 8,
+ std::monostate{});
while (StoreSDNode *Chain = dyn_cast<StoreSDNode>(STChain->getChain())) {
if (Chain->getMemoryVT().isScalableVector())
@@ -25027,7 +25022,7 @@ bool DAGCombiner::parallelizeChainedStores(StoreSDNode *St) {
// If there's a previous interval, we should start after it.
if (I != Intervals.begin() && (--I).stop() <= Offset)
break;
- Intervals.insert(Offset, Offset + Length, Unit);
+ Intervals.insert(Offset, Offset + Length, std::monostate{});
ChainedStores.push_back(Chain);
STChain = Chain;
More information about the llvm-commits
mailing list