mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 20:26:07 +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:
@@ -419,13 +419,7 @@ namespace {
|
|||||||
/// BasicAliasAnalysis - This is the primary alias analysis implementation.
|
/// BasicAliasAnalysis - This is the primary alias analysis implementation.
|
||||||
struct BasicAliasAnalysis : public ImmutablePass, public AliasAnalysis {
|
struct BasicAliasAnalysis : public ImmutablePass, public AliasAnalysis {
|
||||||
static char ID; // Class identification, replacement for typeinfo
|
static char ID; // Class identification, replacement for typeinfo
|
||||||
BasicAliasAnalysis() : ImmutablePass(ID),
|
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) {
|
|
||||||
initializeBasicAliasAnalysisPass(*PassRegistry::getPassRegistry());
|
initializeBasicAliasAnalysisPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,7 +439,11 @@ namespace {
|
|||||||
"BasicAliasAnalysis doesn't support interprocedural queries.");
|
"BasicAliasAnalysis doesn't support interprocedural queries.");
|
||||||
AliasResult Alias = aliasCheck(LocA.Ptr, LocA.Size, LocA.TBAATag,
|
AliasResult Alias = aliasCheck(LocA.Ptr, LocA.Size, LocA.TBAATag,
|
||||||
LocB.Ptr, LocB.Size, LocB.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;
|
return Alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,7 +481,7 @@ namespace {
|
|||||||
private:
|
private:
|
||||||
// AliasCache - Track alias queries to guard against recursion.
|
// AliasCache - Track alias queries to guard against recursion.
|
||||||
typedef std::pair<Location, Location> LocPair;
|
typedef std::pair<Location, Location> LocPair;
|
||||||
typedef DenseMap<LocPair, AliasResult> AliasCacheTy;
|
typedef SmallDenseMap<LocPair, AliasResult, 8> AliasCacheTy;
|
||||||
AliasCacheTy AliasCache;
|
AliasCacheTy AliasCache;
|
||||||
|
|
||||||
// Visited - Track instructions visited by pointsToConstantMemory.
|
// Visited - Track instructions visited by pointsToConstantMemory.
|
||||||
|
Reference in New Issue
Block a user