Skip to content

Conversation

rupprecht
Copy link
Collaborator

This reverts commit d6b7ac8. Build breakages reported on the PR hint at not working with certain versions of the host compiler.

…)"

This reverts commit d6b7ac8. Build breakages reported on the PR hint at not working with certain versions of the host compiler.
@rupprecht rupprecht added the skip-precommit-approval PR for CI feedback, not intended for review label Sep 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 18, 2025

@llvm/pr-subscribers-llvm-ir

Author: Jordan Rupprecht (rupprecht)

Changes

This reverts commit d6b7ac8. Build breakages reported on the PR hint at not working with certain versions of the host compiler.


Full diff: https://github.com/llvm/llvm-project/pull/159622.diff

1 Files Affected:

  • (modified) llvm/lib/IR/Metadata.cpp (+7-2)
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<T *, InfoT> &Store) {
 }
 
 template <class NodeTy> struct MDNode::HasCachedHash {
+  using Yes = char[1];
+  using No = char[2];
+  template <class U, U Val> struct SFINAE {};
+
   template <class U>
-  using check = decltype(static_cast<void (U::*)(unsigned)>(&U::setHash));
+  static Yes &check(SFINAE<void (U::*)(unsigned), &U::setHash> *);
+  template <class U> static No &check(...);
 
-  static constexpr bool value = is_detected<check, NodeTy>::value;
+  static const bool value = sizeof(check<NodeTy>(nullptr)) == sizeof(Yes);
 };
 
 MDNode *MDNode::uniquify() {

@rupprecht rupprecht enabled auto-merge (squash) September 18, 2025 18:34
Copy link
Contributor

@kazutakahirata kazutakahirata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for taking care of this!

@rupprecht rupprecht merged commit 3e0c58b into llvm:main Sep 18, 2025
12 checks passed
@rupprecht rupprecht deleted the revert-metadata-nfc branch September 18, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:ir skip-precommit-approval PR for CI feedback, not intended for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants