i965/cse: Don't eliminate instructions with side-effects
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 8 Aug 2014 21:30:25 +0000 (14:30 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 11 Aug 2014 18:40:32 +0000 (11:40 -0700)
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@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs_cse.cpp
src/mesa/drivers/dri/i965/brw_vec4_cse.cpp

index 01790ada8b493a2837717b0e6c418a79a47f7fd6..033c09e0f850602888bb3868c10bf3486bd2d156 100644 (file)
@@ -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();
    }
 }
 
index 29d2e026205bbcb9b98096512d4ce2d6fdd761a1..1b8c9872d7f0f6426521f7123b7643fb6f3e3f35 100644 (file)
@@ -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();
    }
 }