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
0001-st-mesa-kill-instruction-if-writemask-0-in-eliminate.patch
Description: application/pgp-keys
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev