[llvm] [AllocToken] Add TypeFuncHash and TypeFuncHashPointerSplit modes (PR #227686)
Ai Nozaki via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 1 09:47:07 PDT 2026
================
@@ -1357,35 +1357,35 @@ MDNode *MDNode::getMergedAllocTokenMetadata(const MDNode *A, const MDNode *B) {
return nullptr;
if (A == B)
return const_cast<MDNode *>(A);
- if (A->getNumOperands() != 2 || B->getNumOperands() != 2)
+ const unsigned NumOps = A->getNumOperands();
+ if ((NumOps != 2 && NumOps != 3) || B->getNumOperands() != NumOps)
return nullptr;
auto *CIA = mdconst::dyn_extract_or_null<ConstantInt>(A->getOperand(1));
auto *CIB = mdconst::dyn_extract_or_null<ConstantInt>(B->getOperand(1));
if (!CIA || !CIB)
return nullptr;
- MDString *NameA = dyn_cast<MDString>(A->getOperand(0));
- MDString *NameB = dyn_cast<MDString>(B->getOperand(0));
- if (!NameA || !NameB)
- return nullptr;
-
- if (NameA == NameB)
- return CIA->isOne() ? const_cast<MDNode *>(A) : const_cast<MDNode *>(B);
-
+ // Join different names with '|'.
----------------
ainozaki wrote:
Thank you for catching this. Done. I've updated `MergeNames` to preserve an empty type name when either side is unknown and added a test case. I also switched to `dyn_cast_or_null<MDString>`.
https://github.com/llvm/llvm-project/pull/227686
More information about the llvm-commits
mailing list