[llvm] SelectionDAG: Add missing AddNodeIDCustom case for MDNodeSDNode. (PR #136805)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 20:55:04 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-selectiondag

Author: Peter Collingbourne (pcc)

<details>
<summary>Changes</summary>

Without this we ended up never deduplicating MDNodeSDNodes.


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


1 Files Affected:

- (modified) llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (+3) 


``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index a41efd58ce4e4..0a2687a16a80c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -967,6 +967,9 @@ static void AddNodeIDCustom(FoldingSetNodeID &ID, const SDNode *N) {
   case ISD::INTRINSIC_W_CHAIN:
     // Handled by MemIntrinsicSDNode check after the switch.
     break;
+  case ISD::MDNODE_SDNODE:
+    ID.AddPointer(cast<MDNodeSDNode>(N)->getMD());
+    break;
   } // end switch (N->getOpcode())
 
   // MemIntrinsic nodes could also have subclass data, address spaces, and flags

``````````

</details>


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


More information about the llvm-commits mailing list