[Mesa-dev] [PATCH 6/7] radeonsi: remove local variable 'mod' from si_compile_tgsi_shader
Nicolai Hähnle
nhaehnle at gmail.com
Fri Apr 14 20:57:59 UTC 2017
On 14.04.2017 17:08, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/gallium/drivers/radeonsi/si_shader.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 6242ec1..704c67e 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -7481,21 +7481,20 @@ static void si_build_wrapper_function(struct si_shader_context *ctx,
> }
>
> int si_compile_tgsi_shader(struct si_screen *sscreen,
> LLVMTargetMachineRef tm,
> struct si_shader *shader,
> bool is_monolithic,
> struct pipe_debug_callback *debug)
> {
> struct si_shader_selector *sel = shader->selector;
> struct si_shader_context ctx;
> - LLVMModuleRef mod;
> int r = -1;
>
> /* Dump TGSI code before doing TGSI->LLVM conversion in case the
> * conversion fails. */
> if (r600_can_dump_shader(&sscreen->b, sel->info.processor) &&
> !(sscreen->b.debug_flags & DBG_NO_TGSI)) {
> tgsi_dump(sel->tokens, 0);
> si_dump_streamout(&sel->so);
> }
>
> @@ -7592,40 +7591,38 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
> parts[0] = ctx.main_fn;
> }
>
> si_get_ps_epilog_key(shader, &epilog_key);
> si_build_ps_epilog_function(&ctx, &epilog_key);
> parts[need_prolog ? 2 : 1] = ctx.main_fn;
>
> si_build_wrapper_function(&ctx, parts, need_prolog ? 3 : 2, need_prolog ? 1 : 0);
> }
>
> - mod = ctx.gallivm.module;
> -
> /* Dump LLVM IR before any optimization passes */
> if (sscreen->b.debug_flags & DBG_PREOPT_IR &&
> r600_can_dump_shader(&sscreen->b, ctx.type))
> - ac_dump_module(mod);
> + LLVMDumpModule(ctx.gallivm.module);
Are you sure this works? Wasn't there some issue with different LLVM
versions not having the function?
Or wait... I think the function was briefly removed in trunk and then
added again, so it's probably fine.
The series is
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> si_llvm_finalize_module(&ctx,
> r600_extra_shader_checks(&sscreen->b, ctx.type));
>
> /* Post-optimization transformations and analysis. */
> si_eliminate_const_vs_outputs(&ctx);
>
> if ((debug && debug->debug_message) ||
> r600_can_dump_shader(&sscreen->b, ctx.type))
> si_count_scratch_private_memory(&ctx);
>
> /* Compile to bytecode. */
> r = si_compile_llvm(sscreen, &shader->binary, &shader->config, tm,
> - mod, debug, ctx.type, "TGSI shader");
> + ctx.gallivm.module, debug, ctx.type, "TGSI shader");
> si_llvm_dispose(&ctx);
> if (r) {
> fprintf(stderr, "LLVM failed to compile shader\n");
> return r;
> }
>
> /* Validate SGPR and VGPR usage for compute to detect compiler bugs.
> * LLVM 3.9svn has this bug.
> */
> if (sel->type == PIPE_SHADER_COMPUTE) {
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list