[Mesa-dev] [PATCH] st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()
Brian Paul
brianp at vmware.com
Tue Oct 11 07:22:33 PDT 2011
On 10/09/2011 12:50 PM, Bryan Cain wrote:
> I don't think there's any reason we can't eliminate a dead instruction
> when the writemask is zero. I do wonder, though, why this patch
> actually makes a difference. There's an "if (!inst->dead_mask ||
> !inst->dst.writemask)" three lines before the code visible in the patch
> that makes it not kill the instruction if the writemask is zero. I
> don't remember why that's there, but if it weren't there, and the
> writemask is zero, the dead_mask should also be zero, so it should be
> handled by the "else if" block.
>
> In short, I think that entire if/else if/else statement could use a look.
For the failing case, inst->dead_mask=0xf and inst->dst.writemask=0x8.
So the 'continue' clause isn't taken. And dead_mask != writemask so
the existing iter.remove() clause isn't taken either.
The else if test could be changed from:
else if (inst->dead_mask == inst->dst.writemask) {
to read:
else if ((inst->dst.writemask & ~inst->dead_mask) == 0) {
That works here. Patch attached. Look OK?
-Brian
More information about the mesa-dev
mailing list