Skip to content

Commit 0ff783a

Browse files
authored
[GVN/MemDep] Limit the size of the cache for non-local dependencies. (#150539)
An attempt to resolve the issue flagged in [PR150531](#150531)
1 parent cc60491 commit 0ff783a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/Analysis/MemoryDependenceAnalysis.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ static cl::opt<unsigned>
8080
cl::desc("The number of blocks to scan during memory "
8181
"dependency analysis (default = 200)"));
8282

83+
static cl::opt<unsigned> CacheGlobalLimit(
84+
"memdep-cache-global-limit", cl::Hidden, cl::init(10000),
85+
cl::desc("The max number of entries allowed in a cache (default = 10000)"));
86+
8387
// Limit on the number of memdep results to process.
8488
static const unsigned int NumResultsLimit = 100;
8589

@@ -1142,6 +1146,10 @@ bool MemoryDependenceResults::getNonLocalPointerDepFromBB(
11421146
return true;
11431147
}
11441148

1149+
// If the size of this cache has surpassed the global limit, stop here.
1150+
if (Cache->size() > CacheGlobalLimit)
1151+
return false;
1152+
11451153
// Otherwise, either this is a new block, a block with an invalid cache
11461154
// pointer or one that we're about to invalidate by putting more info into
11471155
// it than its valid cache info. If empty and not explicitly indicated as

0 commit comments

Comments
 (0)