diff options
Diffstat (limited to 'src/backend/jit/llvm/llvmjit.c')
-rw-r--r-- | src/backend/jit/llvm/llvmjit.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index 5a33e52e1dc..daae964b1ce 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -468,6 +468,10 @@ llvm_optimize_module(LLVMJitContext *context, LLVMModuleRef module) /* always use always-inliner pass */ if (!(context->base.flags & PGJIT_OPT3)) LLVMAddAlwaysInlinerPass(llvm_mpm); + /* if doing inlining, but no expensive optimization, add inlining pass */ + if (context->base.flags & PGJIT_INLINE + && !(context->base.flags & PGJIT_OPT3)) + LLVMAddFunctionInliningPass(llvm_mpm); LLVMRunPassManager(llvm_mpm, context->module); LLVMDisposePassManager(llvm_mpm); @@ -491,6 +495,16 @@ llvm_compile_module(LLVMJitContext *context) else compile_orc = llvm_opt0_orc; + /* perform inlining */ + if (context->base.flags & PGJIT_INLINE) + { + INSTR_TIME_SET_CURRENT(starttime); + llvm_inline(context->module); + INSTR_TIME_SET_CURRENT(endtime); + INSTR_TIME_ACCUM_DIFF(context->base.inlining_counter, + endtime, starttime); + } + if (jit_dump_bitcode) { char *filename; @@ -578,7 +592,8 @@ llvm_compile_module(LLVMJitContext *context) MemoryContextSwitchTo(oldcontext); ereport(DEBUG1, - (errmsg("time to opt: %.3fs, emit: %.3fs", + (errmsg("time to inline: %.3fs, opt: %.3fs, emit: %.3fs", + INSTR_TIME_GET_DOUBLE(context->base.inlining_counter), INSTR_TIME_GET_DOUBLE(context->base.optimization_counter), INSTR_TIME_GET_DOUBLE(context->base.emission_counter)), errhidestmt(true), |