diff options
author | Marek Olšák <[email protected]> | 2016-06-09 02:22:25 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-06-14 20:22:16 +0200 |
commit | 8fc688c303135985c2090eceddb5228dbffb74ca (patch) | |
tree | 3c62d72bb8c0408c1fcf2f2d5c2481d89b99da53 /src/gallium/drivers/radeonsi | |
parent | 4eea710b0d050275b532dbc117da97f569e5fb1e (diff) |
radeonsi: don't generate "ret void undef"
Use LLVMBuildRetVoid in epilogs and the GS copy shader and
si_llvm_build_ret otherwise.
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index f2bd3370c8a..6dc4985f94f 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6230,6 +6230,14 @@ int si_compile_llvm(struct si_screen *sscreen, return r; } +static void si_llvm_build_ret(struct si_shader_context *ctx, LLVMValueRef ret) +{ + if (LLVMGetTypeKind(LLVMTypeOf(ret)) == LLVMVoidTypeKind) + LLVMBuildRetVoid(ctx->radeon_bld.gallivm.builder); + else + LLVMBuildRet(ctx->radeon_bld.gallivm.builder, ret); +} + /* Generate code for the hardware VS shader stage to go with a geometry shader */ static int si_generate_gs_copy_shader(struct si_screen *sscreen, struct si_shader_context *ctx, @@ -6291,7 +6299,7 @@ static int si_generate_gs_copy_shader(struct si_screen *sscreen, si_llvm_export_vs(bld_base, outputs, gsinfo->num_outputs); - LLVMBuildRet(gallivm->builder, ctx->return_value); + LLVMBuildRetVoid(gallivm->builder); /* Dump LLVM IR before any optimization passes */ if (sscreen->b.debug_flags & DBG_PREOPT_IR && @@ -6572,7 +6580,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen, goto out; } - LLVMBuildRet(bld_base->base.gallivm->builder, ctx.return_value); + si_llvm_build_ret(&ctx, ctx.return_value); mod = bld_base->base.gallivm->module; /* Dump LLVM IR before any optimization passes */ @@ -6807,7 +6815,7 @@ static bool si_compile_vs_prolog(struct si_screen *sscreen, } /* Compile. */ - LLVMBuildRet(gallivm->builder, ret); + si_llvm_build_ret(&ctx, ret); radeon_llvm_finalize_module(&ctx.radeon_bld); if (si_compile_llvm(sscreen, &out->binary, &out->config, tm, @@ -6880,7 +6888,7 @@ static bool si_compile_vs_epilog(struct si_screen *sscreen, } /* Compile. */ - LLVMBuildRet(gallivm->builder, ctx.return_value); + LLVMBuildRetVoid(gallivm->builder); radeon_llvm_finalize_module(&ctx.radeon_bld); if (si_compile_llvm(sscreen, &out->binary, &out->config, tm, @@ -7035,7 +7043,7 @@ static bool si_compile_tcs_epilog(struct si_screen *sscreen, LLVMGetParam(func, last_sgpr + 3)); /* Compile. */ - LLVMBuildRet(gallivm->builder, ctx.return_value); + LLVMBuildRetVoid(gallivm->builder); radeon_llvm_finalize_module(&ctx.radeon_bld); if (si_compile_llvm(sscreen, &out->binary, &out->config, tm, @@ -7228,7 +7236,7 @@ static bool si_compile_ps_prolog(struct si_screen *sscreen, } /* Compile. */ - LLVMBuildRet(gallivm->builder, ret); + si_llvm_build_ret(&ctx, ret); radeon_llvm_finalize_module(&ctx.radeon_bld); if (si_compile_llvm(sscreen, &out->binary, &out->config, tm, |