--- src/mesa/drivers/dri/i965/brw_vec4.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 536a4b6..f1c5210 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -423,7 +423,7 @@ try_eliminate_instruction(vec4_instruction *inst, int new_writemask, if (inst->writes_accumulator || inst->writes_flag()) { inst->dst = dst_reg(retype(brw_null_reg(), inst->dst.type)); } else { - inst->remove(); + inst->opcode = BRW_OPCODE_NOP; } return true; @@ -462,7 +462,7 @@ vec4_visitor::dead_code_eliminate() calculate_live_intervals(); - foreach_in_list_safe(vec4_instruction, inst, &instructions) { + foreach_block_and_inst(block, vec4_instruction, inst, cfg) { pc++; bool inst_writes_flag = false; @@ -523,7 +523,7 @@ vec4_visitor::dead_code_eliminate() if (inst_writes_flag) { if (scan_inst->dst.is_null() && scan_inst->writes_flag()) { - scan_inst->remove(); + scan_inst->opcode = BRW_OPCODE_NOP; progress = true; continue; } else if (scan_inst->reads_flag()) { @@ -553,8 +553,15 @@ vec4_visitor::dead_code_eliminate() } } - if (progress) - invalidate_live_intervals(); + if (progress) { + foreach_block_and_inst_safe (block, backend_instruction, inst, cfg) { + if (inst->opcode == BRW_OPCODE_NOP) { + inst->remove(block); + } + } + + invalidate_live_intervals(false); + } return progress; } @@ -690,7 +697,9 @@ vec4_visitor::opt_algebraic() { bool progress = false; - foreach_in_list(vec4_instruction, inst, &instructions) { + calculate_cfg(); + + foreach_block_and_inst(block, vec4_instruction, inst, cfg) { switch (inst->opcode) { case BRW_OPCODE_ADD: if (inst->src[1].is_zero()) { @@ -730,7 +739,7 @@ vec4_visitor::opt_algebraic() } if (progress) - invalidate_live_intervals(); + invalidate_live_intervals(false); return progress; } -- 1.8.5.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev