From a187d6f327f3882f1925c95b7e9ac553d62d4a9f Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Tue, 8 Dec 2015 00:10:56 +0000 Subject: [PATCH] [PassManager] Tuning Memory Usage of AnalysisUsage We were using unneccessarily large initial sizes for these SmallVectors. This was wasting around 50kb of memory for the O3 pipeline, even after the uniquing changes. We're still using around 20kb which is a bit much, but it's definitely better. This is about a 6% improvement in total O3 memory usage. Note: The raw data on structure size which were used to pick these thresholds can be found in the review thread. Differential Revision: http://reviews.llvm.org/D15244 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254974 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/PassAnalysisSupport.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h index f6265b62cbf..492a4ef464f 100644 --- a/include/llvm/PassAnalysisSupport.h +++ b/include/llvm/PassAnalysisSupport.h @@ -36,11 +36,17 @@ namespace llvm { /// class AnalysisUsage { public: - typedef SmallVector VectorType; + typedef SmallVectorImpl VectorType; private: /// Sets of analyses required and preserved by a pass - VectorType Required, RequiredTransitive, Preserved, Used; + // TODO: It's not clear that SmallVector is an appropriate data structure for + // this usecase. The sizes were picked to minimize wasted space, but are + // otherwise fairly meaningless. + SmallVector Required; + SmallVector RequiredTransitive; + SmallVector Preserved; + SmallVector Used; bool PreservesAll; public: -- 2.34.1