[llvm] [Support] Use block numbers for DomTree construction (PR #101706)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 07:36:39 PDT 2024


================
@@ -80,6 +81,16 @@ struct GraphTraits {
   using NodeRef = typename GraphType::UnknownGraphTypeError;
 };
 
+namespace detail {
+template <typename T>
+using has_number_t = decltype(GraphTraits<T>::getNumber(std::declval<T>()));
+} // namespace detail
+
+/// Indicate whether a GraphTraits<NodeT>::getNumber() is supported.
+template <typename NodeT>
+constexpr bool GraphHasNodeNumbers =
+    is_detected<detail::has_number_t, NodeT>::value;
----------------
aengelke wrote:

DomTreeBase also has has_number_t, which I'll deduplicate as a follow up. I expect that there'll be more users over time (GenericLoopInfo is something I have on my list).

https://github.com/llvm/llvm-project/pull/101706


More information about the llvm-commits mailing list