Skip to content

Commit

Permalink
Compute some Debug Info Metadata hash key partially (NFC)
Browse files Browse the repository at this point in the history
Summary:
This patch changes the computation of the hash key for DISubprogram to
be computed on a small subset of the fields. The hash is computed a
lot faster, but there might be more collision in the table.
However by carefully selecting the fields, colisions should be rare.

Using `opt` to load the IR for FastISelEmitter.cpp.o, with this patch:
 - DISubprogram::getImpl() goes from 28ms to 15ms.
 - DICompositeType::getImpl() goes from 6ms to 2ms
 - DIDerivedType::getImpl() goes from 18 to 12ms

Reviewers: dexonsmith

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D16571

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 263866
  • Loading branch information
joker-eph committed Mar 19, 2016
1 parent d23be3d commit 53fc389
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions llvm/lib/IR/LLVMContextImpl.h
Expand Up @@ -365,8 +365,7 @@ template <> struct MDNodeKeyImpl<DIDerivedType> {
ExtraData == RHS->getRawExtraData();
}
unsigned getHashValue() const {
return hash_combine(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
AlignInBits, OffsetInBits, Flags, ExtraData);
return hash_combine(Tag, Name, File, Line, Scope, BaseType, Flags);
}
};

Expand Down Expand Up @@ -422,9 +421,8 @@ template <> struct MDNodeKeyImpl<DICompositeType> {
Identifier == RHS->getIdentifier();
}
unsigned getHashValue() const {
return hash_combine(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
VTableHolder, TemplateParams, Identifier);
return hash_combine(Name, File, Line, BaseType, Scope, Elements,
TemplateParams);
}
};

Expand Down Expand Up @@ -518,10 +516,7 @@ template <> struct MDNodeKeyImpl<DISubprogram> {
Variables == RHS->getRawVariables();
}
unsigned getHashValue() const {
return hash_combine(Scope, Name, LinkageName, File, Line, Type,
IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
Virtuality, VirtualIndex, Flags, IsOptimized,
TemplateParams, Declaration, Variables);
return hash_combine(Name, Scope, File, Type, Line);
}
};

Expand Down

0 comments on commit 53fc389

Please sign in to comment.