mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Switch BasicAliasAnalysis' cache to SmallDenseMap.
It relies on clear() being fast and the cache rarely has more than 1 or 2 elements, so give it an inline capacity and always shrink it back down in case it grows. DenseMap will grow to 64 buckets which makes clear() a lot slower. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163215 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4c3d3ecdf8
commit
998d3cca29
@ -419,13 +419,7 @@ namespace {
|
||||
/// BasicAliasAnalysis - This is the primary alias analysis implementation.
|
||||
struct BasicAliasAnalysis : public ImmutablePass, public AliasAnalysis {
|
||||
static char ID; // Class identification, replacement for typeinfo
|
||||
BasicAliasAnalysis() : ImmutablePass(ID),
|
||||
// AliasCache rarely has more than 1 or 2 elements,
|
||||
// so start it off fairly small so that clear()
|
||||
// doesn't have to tromp through 64 (the default)
|
||||
// elements on each alias query. This really wants
|
||||
// something like a SmallDenseMap.
|
||||
AliasCache(8) {
|
||||
BasicAliasAnalysis() : ImmutablePass(ID) {
|
||||
initializeBasicAliasAnalysisPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
@ -445,7 +439,11 @@ namespace {
|
||||
"BasicAliasAnalysis doesn't support interprocedural queries.");
|
||||
AliasResult Alias = aliasCheck(LocA.Ptr, LocA.Size, LocA.TBAATag,
|
||||
LocB.Ptr, LocB.Size, LocB.TBAATag);
|
||||
AliasCache.clear();
|
||||
// AliasCache rarely has more than 1 or 2 elements, always use
|
||||
// shrink_and_clear so it quickly returns to the inline capacity of the
|
||||
// SmallDenseMap if it ever grows larger.
|
||||
// FIXME: This should really be shrink_to_inline_capacity_and_clear().
|
||||
AliasCache.shrink_and_clear();
|
||||
return Alias;
|
||||
}
|
||||
|
||||
@ -483,7 +481,7 @@ namespace {
|
||||
private:
|
||||
// AliasCache - Track alias queries to guard against recursion.
|
||||
typedef std::pair<Location, Location> LocPair;
|
||||
typedef DenseMap<LocPair, AliasResult> AliasCacheTy;
|
||||
typedef SmallDenseMap<LocPair, AliasResult, 8> AliasCacheTy;
|
||||
AliasCacheTy AliasCache;
|
||||
|
||||
// Visited - Track instructions visited by pointsToConstantMemory.
|
||||
|
Loading…
Reference in New Issue
Block a user