Reduce memory usage by halving the materialization threshold.
Also, functions declared with __attribute__((always_inline)) MUST be
inlined.
Note that FunctionInlining uses a heuristic to inline direct function
calls to small functions. Function size (computed by # of basic blocks
* some factors) < Inlining-threshold will be inlined.
But invoke* insn should be inlined by other means anyway.
Change-Id: I3f06ead75c78dfc83985458809311b7fa78bc1d7
diff --git a/src/compiler_llvm/compilation_unit.cc b/src/compiler_llvm/compilation_unit.cc
index e7f77e2..1c47392 100644
--- a/src/compiler_llvm/compilation_unit.cc
+++ b/src/compiler_llvm/compilation_unit.cc
@@ -347,8 +347,8 @@
// Add optimization pass
llvm::PassManagerBuilder pm_builder;
- pm_builder.Inliner = llvm::createFunctionInliningPass();
- //pm_builder.Inliner = llvm::createAlwaysInlinerPass();
+ //pm_builder.Inliner = llvm::createFunctionInliningPass();
+ pm_builder.Inliner = llvm::createAlwaysInlinerPass();
//pm_builder.Inliner = llvm::createPartialInliningPass();
pm_builder.OptLevel = 3;
pm_builder.DisableSimplifyLibCalls = 1;
diff --git a/src/compiler_llvm/compilation_unit.h b/src/compiler_llvm/compilation_unit.h
index fb5f4e4..a464df0 100644
--- a/src/compiler_llvm/compilation_unit.h
+++ b/src/compiler_llvm/compilation_unit.h
@@ -98,7 +98,7 @@
bool IsMaterializeThresholdReached() const {
MutexLock GUARD(cunit_lock_);
- return (mem_usage_ > 10000000u); // (threshold: 10 MB)
+ return (mem_usage_ > 5000000u); // (threshold: 5 MB)
}
void AddMemUsageApproximation(size_t usage) {