Since compare instructions write the flag register, they should not be considered dead even if their destination is never read. Instead of removing them if found to be dead, set their destination to null to free a register. --- v2: New commit message. This is now patch 6/7.
src/mesa/drivers/dri/i965/brw_fs.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 03765b6..64ff75a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1902,10 +1902,12 @@ fs_visitor::dead_code_eliminate() if (dead) { /* Don't dead code eliminate instructions that write to the - * accumulator as a side-effect. Instead just set the destination - * to the null register to free it. + * accumulator or flag register as a side effect. Instead just set + * the destination to the null register to free it. */ switch (inst->opcode) { + case BRW_OPCODE_CMP: + case BRW_OPCODE_CMPN: case BRW_OPCODE_ADDC: case BRW_OPCODE_SUBB: case BRW_OPCODE_MACH: -- 1.8.3.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev