diff options
author | Alina Sbirlea <asbirlea@google.com> | 2025-09-23 14:54:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-23 14:54:29 -0700 |
commit | 0ff783a256365649146edbc0596b2f3268405ffb (patch) | |
tree | d4a99e0736fad2633a2958b200a6390d2f2b0a15 /llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | |
parent | cc604919dd399f3104cf911e83ee02f3d8fad905 (diff) | |
download | llvm-0ff783a256365649146edbc0596b2f3268405ffb.zip llvm-0ff783a256365649146edbc0596b2f3268405ffb.tar.gz llvm-0ff783a256365649146edbc0596b2f3268405ffb.tar.bz2 |
[GVN/MemDep] Limit the size of the cache for non-local dependencies. (#150539)
An attempt to resolve the issue flagged in
[PR150531](https://github.com/llvm/llvm-project/issues/150531)
Diffstat (limited to 'llvm/lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index 67c2cfa..9a022d9 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -80,6 +80,10 @@ static cl::opt<unsigned> cl::desc("The number of blocks to scan during memory " "dependency analysis (default = 200)")); +static cl::opt<unsigned> CacheGlobalLimit( + "memdep-cache-global-limit", cl::Hidden, cl::init(10000), + cl::desc("The max number of entries allowed in a cache (default = 10000)")); + // Limit on the number of memdep results to process. static const unsigned int NumResultsLimit = 100; @@ -1142,6 +1146,10 @@ bool MemoryDependenceResults::getNonLocalPointerDepFromBB( return true; } + // If the size of this cache has surpassed the global limit, stop here. + if (Cache->size() > CacheGlobalLimit) + return false; + // Otherwise, either this is a new block, a block with an invalid cache // pointer or one that we're about to invalidate by putting more info into // it than its valid cache info. If empty and not explicitly indicated as |