summaryrefslogtreecommitdiff
path: root/tools/opt
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-03-10 01:28:54 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-03-10 01:28:54 +0000
commit2de9927963f76466d0a1836479a6732ee133a50c (patch)
tree5ef280d46e6e1f001720945cc424f006b871ac07 /tools/opt
parentd18bb9e06b6b95ecddcd726c4661f8fa5742975a (diff)
Add a flag to the LLVMContext to disable name for Value other than GlobalValue
Summary: This is intended to be a performance flag, on the same level as clang cc1 option "--disable-free". LLVM will never initialize it by default, it will be up to the client creating the LLVMContext to request this behavior. Clang will do it by default in Release build (just like --disable-free). "opt" and "llc" can opt-in using -disable-named-value command line option. When performing LTO on llvm-tblgen, the initial merging of IR peaks at 92MB without this patch, and 86MB after this patch,setNameImpl() drops from 6.5MB to 0.5MB. The total link time goes from ~29.5s to ~27.8s. Compared to a compile-time flag (like the IRBuilder one), it performs very close. I profiled on SROA and obtain these results: 420ms with IRBuilder that preserve name 372ms with IRBuilder that strip name 375ms with IRBuilder that preserve name, and a runtime flag to strip Reviewers: chandlerc, dexonsmith, bogner Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D17946 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263086 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt')
-rw-r--r--tools/opt/opt.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index dc60f3cdf9b..28c1c2bc6c5 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -196,6 +196,11 @@ static cl::opt<bool>
cl::desc("Run all passes twice, re-using the same pass manager."),
cl::init(false), cl::Hidden);
+static cl::opt<bool> DiscardValueNames(
+ "discard-value-names",
+ cl::desc("Discard names from Value (other than GlobalValue)."),
+ cl::init(false), cl::Hidden);
+
static inline void addPass(legacy::PassManagerBase &PM, Pass *P) {
// Add the pass to the pass manager...
PM.add(P);
@@ -346,6 +351,8 @@ int main(int argc, char **argv) {
SMDiagnostic Err;
+ Context.setDiscardValueNames(DiscardValueNames);
+
// Load the input module...
std::unique_ptr<Module> M = parseIRFile(InputFilename, Err, Context);