Skip to content

Commit cadaf89

Browse files
committed
[GVN/MemDep] Limit the size of the cache for non-local dependencies.
1 parent b7908e3 commit cadaf89

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

llvm/lib/Analysis/MemoryDependenceAnalysis.cpp

Lines changed: 9 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+
"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,11 @@ 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+
}
1153+
11451154
// Otherwise, either this is a new block, a block with an invalid cache
11461155
// pointer or one that we're about to invalidate by putting more info into
11471156
// it than its valid cache info. If empty and not explicitly indicated as

0 commit comments

Comments
 (0)