gallium/radeon: emit LLVM ret void before radeon_llvm_finalize_module

This allows dumping a consumable LLVM module before the initial optimization
passes are run.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Nicolai Hähnle 2016-02-04 08:51:52 +01:00
parent 7e9670c8bc
commit 5aafc169ca
3 changed files with 4 additions and 3 deletions

View file

@ -848,6 +848,7 @@ LLVMModuleRef r600_tgsi_llvm(
lp_build_tgsi_llvm(bld_base, tokens);
LLVMBuildRetVoid(bld_base->base.gallivm->builder);
radeon_llvm_finalize_module(ctx);
return ctx->gallivm.module;

View file

@ -1710,11 +1710,9 @@ void radeon_llvm_create_func(struct radeon_llvm_context * ctx,
void radeon_llvm_finalize_module(struct radeon_llvm_context * ctx)
{
struct gallivm_state * gallivm = ctx->soa.bld_base.base.gallivm;
/* End the main function with Return*/
LLVMBuildRetVoid(gallivm->builder);
/* Create the pass manager */
ctx->gallivm.passmgr = LLVMCreateFunctionPassManagerForModule(
gallivm->passmgr = LLVMCreateFunctionPassManagerForModule(
gallivm->module);
/* This pass should eliminate all the load and store instructions */

View file

@ -4177,6 +4177,7 @@ static int si_generate_gs_copy_shader(struct si_screen *sscreen,
si_llvm_export_vs(bld_base, outputs, gsinfo->num_outputs);
LLVMBuildRetVoid(bld_base->base.gallivm->builder);
radeon_llvm_finalize_module(&si_shader_ctx->radeon_bld);
if (dump)
@ -4383,6 +4384,7 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
goto out;
}
LLVMBuildRetVoid(bld_base->base.gallivm->builder);
radeon_llvm_finalize_module(&si_shader_ctx.radeon_bld);
mod = bld_base->base.gallivm->module;