From: Jason Ekstrand Date: Fri, 8 Aug 2014 21:30:25 +0000 (-0700) Subject: i965/cse: Don't eliminate instructions with side-effects X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f5cc3fdcf1680b116612fac7c39f1bd79f5e555e;p=mesa.git 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 Reviewed-by: Matt Turner --- diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp index 01790ada8b4..033c09e0f85 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 29d2e026205..1b8c9872d7f 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(); } }