diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -72,6 +72,7 @@ #include #include #include +#include using namespace llvm; @@ -24943,13 +24944,6 @@ 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 @@ // 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>; + using IMap = llvm::IntervalMap>; IMap::Allocator A; IMap Intervals(A); @@ -24998,7 +24992,8 @@ 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(STChain->getChain())) { if (Chain->getMemoryVT().isScalableVector()) @@ -25027,7 +25022,7 @@ // 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;