summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/LLVMContextImpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/LLVMContextImpl.h')
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 850c81cfabb..79bd2e12a35 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -612,17 +612,19 @@ template <> struct MDNodeSubsetEqualImpl<DISubprogram> {
typedef MDNodeKeyImpl<DISubprogram> KeyTy;
static bool isSubsetEqual(const KeyTy &LHS, const DISubprogram *RHS) {
return isDeclarationOfODRMember(LHS.IsDefinition, LHS.Scope,
- LHS.LinkageName, RHS);
+ LHS.LinkageName, LHS.TemplateParams, RHS);
}
static bool isSubsetEqual(const DISubprogram *LHS, const DISubprogram *RHS) {
return isDeclarationOfODRMember(LHS->isDefinition(), LHS->getRawScope(),
- LHS->getRawLinkageName(), RHS);
+ LHS->getRawLinkageName(),
+ LHS->getRawTemplateParams(), RHS);
}
/// Subprograms compare equal if they declare the same function in an ODR
/// type.
static bool isDeclarationOfODRMember(bool IsDefinition, const Metadata *Scope,
const MDString *LinkageName,
+ const Metadata *TemplateParams,
const DISubprogram *RHS) {
// Check whether the LHS is eligible.
if (IsDefinition || !Scope || !LinkageName)
@@ -633,8 +635,14 @@ template <> struct MDNodeSubsetEqualImpl<DISubprogram> {
return false;
// Compare to the RHS.
+ // FIXME: We need to compare template parameters here to avoid incorrect
+ // collisions in mapMetadata when RF_MoveDistinctMDs and a ODR-DISubprogram
+ // has a non-ODR template parameter (i.e., a DICompositeType that does not
+ // have an identifier). Eventually we should decouple ODR logic from
+ // uniquing logic.
return IsDefinition == RHS->isDefinition() && Scope == RHS->getRawScope() &&
- LinkageName == RHS->getRawLinkageName();
+ LinkageName == RHS->getRawLinkageName() &&
+ TemplateParams == RHS->getRawTemplateParams();
}
};
OpenPOWER on IntegriCloud