From: Nicolai Hähnle <nicolai.haeh...@amd.com> Change the pass manager as well, since this is a module-level pass. No noticeable run-time difference on shader-db. --- src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c index c7a08cc..2d82574 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c @@ -31,20 +31,21 @@ #include "gallivm/lp_bld_intr.h" #include "gallivm/lp_bld_misc.h" #include "gallivm/lp_bld_swizzle.h" #include "tgsi/tgsi_info.h" #include "tgsi/tgsi_parse.h" #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_debug.h" #include <stdio.h> +#include <llvm-c/Transforms/IPO.h> #include <llvm-c/Transforms/Scalar.h> /* Data for if/else/endif and bgnloop/endloop control flow structures. */ struct si_llvm_flow { /* Loop exit or next part of if/else/endif. */ LLVMBasicBlockRef next_block; LLVMBasicBlockRef loop_entry_block; }; @@ -1326,43 +1327,42 @@ void si_llvm_create_func(struct si_shader_context *ctx, } void si_llvm_finalize_module(struct si_shader_context *ctx, bool run_verifier) { struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm; const char *triple = LLVMGetTarget(gallivm->module); LLVMTargetLibraryInfoRef target_library_info; /* Create the pass manager */ - gallivm->passmgr = LLVMCreateFunctionPassManagerForModule( - gallivm->module); + gallivm->passmgr = LLVMCreatePassManager(); target_library_info = gallivm_create_target_library_info(triple); LLVMAddTargetLibraryInfo(target_library_info, gallivm->passmgr); if (run_verifier) LLVMAddVerifierPass(gallivm->passmgr); + LLVMAddAlwaysInlinerPass(gallivm->passmgr); + /* This pass should eliminate all the load and store instructions */ LLVMAddPromoteMemoryToRegisterPass(gallivm->passmgr); /* Add some optimization passes */ LLVMAddScalarReplAggregatesPass(gallivm->passmgr); LLVMAddLICMPass(gallivm->passmgr); LLVMAddAggressiveDCEPass(gallivm->passmgr); LLVMAddCFGSimplificationPass(gallivm->passmgr); LLVMAddInstructionCombiningPass(gallivm->passmgr); /* Run the pass */ - LLVMInitializeFunctionPassManager(gallivm->passmgr); - LLVMRunFunctionPassManager(gallivm->passmgr, ctx->main_fn); - LLVMFinalizeFunctionPassManager(gallivm->passmgr); + LLVMRunPassManager(gallivm->passmgr, ctx->gallivm.module); LLVMDisposeBuilder(gallivm->builder); LLVMDisposePassManager(gallivm->passmgr); gallivm_dispose_target_library_info(target_library_info); } void si_llvm_dispose(struct si_shader_context *ctx) { LLVMDisposeModule(ctx->soa.bld_base.base.gallivm->module); LLVMContextDispose(ctx->soa.bld_base.base.gallivm->context); -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev