[Mesa-dev] [PATCH] st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()
Marek Olšák
maraeo at gmail.com
Fri Oct 7 11:06:15 PDT 2011
I think ARL is allowed to have no destination register, right? In that
case, there should be a special case not to eliminate ARLs.
Marek
On Fri, Oct 7, 2011 at 5:40 PM, Brian Paul <brian.e.paul at gmail.com> wrote:
> From: Brian Paul <brianp at vmware.com>
>
> This fixes a bug where we'd wind up emitting an invalid instruction like
> MOVE R[0]., R[1]; - note the empty/zero writemask. If we don't write to
> any dest register channels, cull the instruction.
> ---
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index d8ef8a3..44b1149 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -3776,8 +3776,14 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void)
> iter.remove();
> delete inst;
> removed++;
> - } else
> + } else {
> inst->dst.writemask &= ~(inst->dead_mask);
> + if (inst->dst.writemask == 0) {
> + iter.remove();
> + delete inst;
> + removed++;
> + }
> + }
> }
>
> ralloc_free(write_level);
> --
> 1.7.3.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list