intel/fs: Don't copy-propagate stride=0 sources into ddx/ddy
[mesa.git] / src / intel / compiler / brw_fs_copy_propagation.cpp
index bc5af9732b3117f9afe3e69d27f0ae7396868e18..31e55e64a27bf6fb0b99670e6e0ca15ad8d5ecd7 100644 (file)
@@ -524,7 +524,7 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry)
     */
    const unsigned entry_stride = (entry->src.file == FIXED_GRF ? 1 :
                                   entry->src.stride);
-   if (instruction_requires_packed_data(inst) && entry_stride > 1)
+   if (instruction_requires_packed_data(inst) && entry_stride != 1)
       return false;
 
    /* Bail if the result of composing both strides would exceed the
@@ -823,7 +823,11 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
          if (i == 1) {
             inst->src[i] = val;
             progress = true;
-         } else if (i == 0 && inst->src[1].file != IMM) {
+         } else if (i == 0 && inst->src[1].file != IMM &&
+                    (inst->conditional_mod == BRW_CONDITIONAL_NONE ||
+                     /* Only GE and L are commutative. */
+                     inst->conditional_mod == BRW_CONDITIONAL_GE ||
+                     inst->conditional_mod == BRW_CONDITIONAL_L)) {
             inst->src[0] = inst->src[1];
             inst->src[1] = val;