Improve caching scheme in ProvenanceAnalysis.
authorMichael Zolotukhin <mzolotukhin@apple.com>
Mon, 12 Mar 2018 20:36:25 +0000 (20:36 +0000)
committerMichael Zolotukhin <mzolotukhin@apple.com>
Mon, 12 Mar 2018 20:36:25 +0000 (20:36 +0000)
commita3d8ef0f0821f674a24587f0a477cf33e15ae06e
tree02e4ed064021baa610395981d121c1285d1f134e
parentd1faa56f3ddfb104aad9a7b6000eca869c42d8c4
Improve caching scheme in ProvenanceAnalysis.

Summary:
ProvenanceAnalysis::related(A, B) currently memoizes its results, and on big
tests the cache grows too large, and we're spending most of the time
growing/looking through DenseMap.

This patch reduces the size of the cache by normalizing keys first: we do that
by calling GetUnderlyingObjCPtr on the input values. The results of
GetUnderlyingObjCPtr are also memoized in a separate cache.

The patch doesn't bring noticable changes to compile time on CTMark, however
significantly helps one of our internal tests.

Reviewers: gottesmm

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D44270

llvm-svn: 327328
llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h
llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp
llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.h