Mesa (master): i965/cse: Don't eliminate instructions with side-effects

Jason Ekstrand jekstrand at kemper.freedesktop.org
Mon Aug 11 18:40:50 UTC 2014


Module: Mesa
Branch: master
Commit: f5cc3fdcf1680b116612fac7c39f1bd79f5e555e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5cc3fdcf1680b116612fac7c39f1bd79f5e555e

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Fri Aug  8 14:30:25 2014 -0700

i965/cse: Don't eliminate instructions with side-effects

This casues problems when converting atomics to use the GRF.  Sometimes the atomic operation would get eaten by CSE when it shouldn't.

v2: Roll the has_side_effects check into is_expression

Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_fs_cse.cpp   |    2 +-
 src/mesa/drivers/dri/i965/brw_vec4_cse.cpp |    2 +-
 2 files changed, 2 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 01790ad..033c09e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -103,7 +103,7 @@ is_expression(const fs_inst *const inst)
    case SHADER_OPCODE_LOAD_PAYLOAD:
       return !is_copy_payload(inst);
    default:
-      return inst->is_send_from_grf();
+      return inst->is_send_from_grf() && !inst->has_side_effects();
    }
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
index 29d2e02..1b8c987 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
@@ -82,7 +82,7 @@ is_expression(const vec4_instruction *const inst)
    case SHADER_OPCODE_COS:
       return inst->mlen == 0;
    default:
-      return false;
+      return !inst->has_side_effects();
    }
 }
 




More information about the mesa-commit mailing list