summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-08-24 19:27:09 -0700
committerMatt Turner <[email protected]>2014-09-24 09:42:46 -0700
commitb0b64c85e4a0dafbb46405e4b3c17be24b63347f (patch)
tree2cac549c78e7c36ed4e4b4e37e853b4c0564ab61 /src/mesa
parenta9f8296dbb4ee9fba22c4c2af625eaa29676f002 (diff)
i965/vec4: Preserve the CFG in a few more places.
Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.cpp23
1 files 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 d5180263010..b38577a9ae1 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -426,7 +426,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;
@@ -465,7 +465,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;
@@ -526,7 +526,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()) {
@@ -556,8 +556,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;
}
@@ -693,7 +700,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()) {
@@ -733,7 +742,7 @@ vec4_visitor::opt_algebraic()
}
if (progress)
- invalidate_live_intervals();
+ invalidate_live_intervals(false);
return progress;
}