summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-08-22 11:01:13 -0700
committerMatt Turner <[email protected]>2015-01-23 17:57:40 -0800
commit3759a89ad358139ef981bd5d46261ee115762b94 (patch)
treed68bb97921a07aecf19767ec259c455bb791ae44 /src
parent7452f18b226e2f5949729c1ed5c2f87c6dae89c0 (diff)
i965/fs: Eliminate null-dst instructions without side-effects.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
index 81be4def30b..d66808bf45c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
@@ -85,6 +85,17 @@ fs_visitor::dead_code_eliminate()
}
}
+ if ((inst->opcode != BRW_OPCODE_IF &&
+ inst->opcode != BRW_OPCODE_WHILE) &&
+ inst->dst.is_null() &&
+ !inst->has_side_effects() &&
+ !inst->writes_flag() &&
+ !inst->writes_accumulator) {
+ inst->opcode = BRW_OPCODE_NOP;
+ progress = true;
+ continue;
+ }
+
if (inst->dst.file == GRF) {
if (!inst->is_partial_write()) {
int var = live_intervals->var_from_reg(inst->dst);