From: Dave Airlie Date: Tue, 26 Jun 2018 23:02:25 +0000 (+1000) Subject: radv: port to use common passmgr code. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=97d9b88447f52ad0df4845194562cb7f655c1289;p=mesa.git radv: port to use common passmgr code. This adds a inline always pass, but otherwise should work the same. Reviewed-by: Marek Olšák Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c index b25f9e3e6dd..01852dbff46 100644 --- a/src/amd/common/ac_llvm_util.c +++ b/src/amd/common/ac_llvm_util.c @@ -172,8 +172,9 @@ LLVMPassManagerRef ac_create_passmgr(LLVMTargetLibraryInfoRef target_library_inf if (!passmgr) return NULL; - LLVMAddTargetLibraryInfo(target_library_info, - passmgr); + if (target_library_info) + LLVMAddTargetLibraryInfo(target_library_info, + passmgr); if (check_ir) LLVMAddVerifierPass(passmgr); diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index ce6d5e1547d..dbbf2c13d66 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -2996,30 +2996,10 @@ static void ac_llvm_finalize_module(struct radv_shader_context *ctx, const struct radv_nir_compiler_options *options) { LLVMPassManagerRef passmgr; - /* Create the pass manager */ - passmgr = LLVMCreateFunctionPassManagerForModule( - ctx->ac.module); - - if (options->check_ir) - LLVMAddVerifierPass(passmgr); - - /* This pass should eliminate all the load and store instructions */ - LLVMAddPromoteMemoryToRegisterPass(passmgr); - - /* Add some optimization passes */ - LLVMAddScalarReplAggregatesPass(passmgr); - LLVMAddLICMPass(passmgr); - LLVMAddAggressiveDCEPass(passmgr); - LLVMAddCFGSimplificationPass(passmgr); - /* This is recommended by the instruction combining pass. */ - LLVMAddEarlyCSEMemSSAPass(passmgr); - LLVMAddInstructionCombiningPass(passmgr); - - /* Run the pass */ - LLVMInitializeFunctionPassManager(passmgr); - LLVMRunFunctionPassManager(passmgr, ctx->main_function); - LLVMFinalizeFunctionPassManager(passmgr); + passmgr = ac_create_passmgr(NULL, options->check_ir); + + LLVMRunPassManager(passmgr, ctx->ac.module); LLVMDisposeBuilder(ctx->ac.builder); LLVMDisposePassManager(passmgr);