[PATCH] D131778: [DAGCombine] Replace std::monostate equivalent in DAGCombiner.cpp

Joe Loser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 07:28:31 PDT 2022


jloser created this revision.
jloser added reviewers: niravd, david-arm, craig.topper.
Herald added subscribers: StephenFan, ecnelises, hiraditya.
Herald added a project: All.
jloser requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Remove the `UnitT` type and operators in favor of using `std::monostate`
directly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131778

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ 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 @@
   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
@@ -24971,7 +24965,7 @@
   // space and thus merged with the previous interval at insertion time.
 
   using IMap =
-      llvm::IntervalMap<int64_t, UnitT, 8, IntervalMapHalfOpenInfo<int64_t>>;
+      llvm::IntervalMap<int64_t, std::monostate, 8, IntervalMapHalfOpenInfo<int64_t>>;
   IMap::Allocator A;
   IMap Intervals(A);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131778.452179.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220812/5d85b72c/attachment.bin>


More information about the llvm-commits mailing list