[Mesa-dev] [PATCH 26/32] i965/vec4: Don't assume a value is dead when its VGRF is only partially overwritten.

Matt Turner mattst88 at gmail.com
Sun Feb 8 14:10:59 PST 2015


On Fri, Feb 6, 2015 at 6:43 AM, Francisco Jerez <currojerez at riseup.net> wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
> index 9604e60..5df0d31 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
> @@ -122,7 +122,8 @@ vec4_visitor::dead_code_eliminate()
>              }
>           }
>
> -         if (inst->dst.file == GRF && !inst->predicate) {
> +         if (inst->dst.file == GRF && !inst->predicate &&
> +             inst->regs_written == alloc.sizes[inst->dst.reg]) {
>              for (int c = 0; c < 4; c++) {
>                 if (inst->dst.writemask & (1 << c)) {
>                    int var = inst->dst.reg * 4 + c;
> --
> 2.1.3

I think what you're saying is that if an instruction wrote less than
the size of the destination register we would incorrectly mark it as
entirely overwritten?

I'm not reading the code that way. It looks like we're just marking
individual channels (i.e., channels of the writemask) as dead. I don't
see, for example, us using the size of the destination register
anywhere in the loop.

How you triggered this, again, would be helpful.


More information about the mesa-dev mailing list