summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2015-11-13 09:03:55 +0100
committerIago Toral Quiroga <[email protected]>2015-11-16 08:11:13 +0100
commit3f34afa0aad2a9bcfc0e5469a9675eca11ea7649 (patch)
treedf32b8731c00decc84a39e40eb386d8b590cc889 /src/glsl/nir
parentff17b3ccf4f8d9f989cc975cd0e11716ff48bc1d (diff)
nir/copy_propagate: do not copy-propagate MOV srcs with source modifiers
If a source operand in a MOV has source modifiers, then we cannot copy-propagate it from the parent instruction and remove the MOV. v2: remove the check for source modifiers from is_move() (Jason) v3: Put the check for source modifiers back into is_move() since this function is called from copy_prop_alu_src(). Add source modifiers checks to is_vec() instead. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl/nir')
-rw-r--r--src/glsl/nir/nir_opt_copy_propagate.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/glsl/nir/nir_opt_copy_propagate.c b/src/glsl/nir/nir_opt_copy_propagate.c
index 7d8bdd7f2ca..cfc8e331128 100644
--- a/src/glsl/nir/nir_opt_copy_propagate.c
+++ b/src/glsl/nir/nir_opt_copy_propagate.c
@@ -55,10 +55,15 @@ static bool is_move(nir_alu_instr *instr)
static bool is_vec(nir_alu_instr *instr)
{
- for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++)
+ for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
if (!instr->src[i].src.is_ssa)
return false;
+ /* we handle modifiers in a separate pass */
+ if (instr->src[i].abs || instr->src[i].negate)
+ return false;
+ }
+
return instr->op == nir_op_vec2 ||
instr->op == nir_op_vec3 ||
instr->op == nir_op_vec4;