[Mesa-dev] [PATCH] i965/cse: Don't eliminate instructions with side-effects

Jason Ekstrand jason at jlekstrand.net
Fri Aug 8 14:42:27 PDT 2014


In particular, this caused problems where atomics operations were getting
eliminated.

Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs_cse.cpp   | 3 ++-
 src/mesa/drivers/dri/i965/brw_vec4_cse.cpp | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index 63d87f9..8cfc6c6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -177,7 +177,8 @@ fs_visitor::opt_cse_local(bblock_t *block)
    foreach_inst_in_block(fs_inst, inst, block) {
       /* Skip some cases. */
       if (is_expression(inst) && !inst->is_partial_write() &&
-          (inst->dst.file != HW_REG || inst->dst.is_null()))
+          (inst->dst.file != HW_REG || inst->dst.is_null()) &&
+          !inst->has_side_effects())
       {
          bool found = false;
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
index 29d2e02..44651b4 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
@@ -135,7 +135,8 @@ vec4_visitor::opt_cse_local(bblock_t *block)
    foreach_inst_in_block (vec4_instruction, inst, block) {
       /* Skip some cases. */
       if (is_expression(inst) && !inst->predicate && inst->mlen == 0 &&
-          (inst->dst.file != HW_REG || inst->dst.is_null()))
+          (inst->dst.file != HW_REG || inst->dst.is_null()) &&
+          !inst->has_side_effects())
       {
          bool found = false;
 
-- 
2.0.4



More information about the mesa-dev mailing list