From 3d9ff9777b8d50c5520ea5ab9017fc6c7e6b08da Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht Date: Thu, 18 Sep 2025 11:31:35 -0700 Subject: [PATCH] Revert "[IR] Simplify HasCachedHash with is_detected (NFC) (#159510)" This reverts commit d6b7ac830ab4c1b26a1b2eecd15306eccf9cea90. Build breakages reported on the PR hint at not working with certain versions of the host compiler. --- llvm/lib/IR/Metadata.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index 09e25ceaf59c3..fc78a5b299f49 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -986,10 +986,15 @@ static T *uniquifyImpl(T *N, DenseSet &Store) { } template struct MDNode::HasCachedHash { + using Yes = char[1]; + using No = char[2]; + template struct SFINAE {}; + template - using check = decltype(static_cast(&U::setHash)); + static Yes &check(SFINAE *); + template static No &check(...); - static constexpr bool value = is_detected::value; + static const bool value = sizeof(check(nullptr)) == sizeof(Yes); }; MDNode *MDNode::uniquify() {