[Mesa-dev] [PATCH 19/22] glsl: Kill ir_assignment::condition with fire

Ian Romanick idr at freedesktop.org
Thu Sep 21 14:34:32 UTC 2017


From: "\"Ian Romanick\"" <idr at freedesktop.org>

From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/compiler/glsl/glsl_to_nir.cpp             | 16 ++------------
 src/compiler/glsl/ir.cpp                      |  5 ++---
 src/compiler/glsl/ir.h                        |  6 ------
 .../glsl/ir_builder_print_visitor.cpp         |  4 ----
 src/compiler/glsl/ir_clone.cpp                |  2 --
 src/compiler/glsl/ir_constant_expression.cpp  | 12 +----------
 src/compiler/glsl/ir_hv_accept.cpp            |  3 ---
 src/compiler/glsl/ir_print_visitor.cpp        |  3 ---
 src/compiler/glsl/ir_rvalue_visitor.cpp       |  2 --
 src/compiler/glsl/loop_analysis.cpp           |  3 +--
 src/compiler/glsl/loop_controls.cpp           |  2 +-
 src/compiler/glsl/lower_distance.cpp          |  2 +-
 .../lower_variable_index_to_cond_assign.cpp   | 17 +--------------
 .../glsl/lower_vec_index_to_cond_assign.cpp   |  4 ----
 src/compiler/glsl/opt_array_splitting.cpp     |  7 -------
 src/compiler/glsl/opt_constant_folding.cpp    | 17 ---------------
 .../glsl/opt_constant_propagation.cpp         |  3 ---
 src/compiler/glsl/opt_constant_variable.cpp   |  3 ---
 src/compiler/glsl/opt_copy_propagation.cpp    |  3 ---
 .../glsl/opt_copy_propagation_elements.cpp    |  3 ---
 .../glsl/opt_dead_builtin_varyings.cpp        |  1 -
 src/compiler/glsl/opt_dead_code_local.cpp     | 21 +++++++------------
 src/compiler/glsl/opt_structure_splitting.cpp |  7 ++-----
 src/compiler/glsl/opt_tree_grafting.cpp       |  3 +--
 src/compiler/glsl/opt_vectorize.cpp           |  3 +--
 src/mesa/program/ir_to_mesa.cpp               | 16 --------------
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp    | 17 ++++++---------
 27 files changed, 26 insertions(+), 159 deletions(-)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 99df6e0..57b832f 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -1253,13 +1253,7 @@ nir_visitor::visit(ir_assignment *ir)
       copy->variables[0] = evaluate_deref(&copy->instr, ir->lhs);
       copy->variables[1] = evaluate_deref(&copy->instr, ir->rhs);
 
-      if (ir->condition) {
-         nir_push_if(&b, evaluate_rvalue(ir->condition));
-         nir_builder_instr_insert(&b, &copy->instr);
-         nir_pop_if(&b, NULL);
-      } else {
-         nir_builder_instr_insert(&b, &copy->instr);
-      }
+      nir_builder_instr_insert(&b, &copy->instr);
       return;
    }
 
@@ -1290,13 +1284,7 @@ nir_visitor::visit(ir_assignment *ir)
    store->variables[0] = nir_deref_var_clone(lhs_deref, store);
    store->src[0] = nir_src_for_ssa(src);
 
-   if (ir->condition) {
-      nir_push_if(&b, evaluate_rvalue(ir->condition));
-      nir_builder_instr_insert(&b, &store->instr);
-      nir_pop_if(&b, NULL);
-   } else {
-      nir_builder_instr_insert(&b, &store->instr);
-   }
+   nir_builder_instr_insert(&b, &store->instr);
 }
 
 /*
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 4cf322d..52f9133 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -151,7 +151,7 @@ ir_assignment::whole_variable_written()
 ir_assignment::ir_assignment(ir_dereference *lhs, ir_rvalue *rhs,
                              unsigned write_mask)
    : ir_instruction(ir_type_assignment), lhs(lhs), rhs(rhs),
-     condition(NULL), write_mask(write_mask)
+     write_mask(write_mask)
 {
    if (lhs->type->is_scalar() || lhs->type->is_vector()) {
       int lhs_components = 0;
@@ -165,8 +165,7 @@ ir_assignment::ir_assignment(ir_dereference *lhs, ir_rvalue *rhs,
 }
 
 ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs)
-   : ir_instruction(ir_type_assignment), lhs(NULL), rhs(rhs),
-     condition(NULL), write_mask(0)
+   : ir_instruction(ir_type_assignment), lhs(NULL), rhs(rhs), write_mask(0)
 {
    /* If the RHS is a vector type, assume that all components of the vector
     * type are being written to the LHS.  The write mask comes from the RHS
diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index 28a356a..d7f8630 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -1475,12 +1475,6 @@ public:
    ir_rvalue *rhs;
 
    /**
-    * Optional condition for the assignment.
-    */
-   ir_rvalue *condition;
-
-
-   /**
     * Component mask written
     *
     * For non-vector types in the LHS, this field will be zero.  For vector
diff --git a/src/compiler/glsl/ir_builder_print_visitor.cpp b/src/compiler/glsl/ir_builder_print_visitor.cpp
index 3e30c5d..1f29562 100644
--- a/src/compiler/glsl/ir_builder_print_visitor.cpp
+++ b/src/compiler/glsl/ir_builder_print_visitor.cpp
@@ -503,8 +503,6 @@ ir_builder_print_visitor::visit_enter(ir_assignment *ir)
    if (s != visit_continue)
       return (s == visit_continue_with_parent) ? visit_continue : s;
 
-   assert(ir->condition == NULL);
-
    const struct hash_entry *const he_lhs =
       _mesa_hash_table_search(index_map, ir->lhs);
 
@@ -525,8 +523,6 @@ ir_builder_print_visitor::visit_leave(ir_assignment *ir)
    const struct hash_entry *const he_rhs =
       _mesa_hash_table_search(index_map, ir->rhs);
 
-   assert(ir->condition == NULL);
-
    print_with_indent("body.emit(assign(r%04X, r%04X, 0x%02x));\n\n",
                      (unsigned)(uintptr_t) he_lhs->data,
                      (unsigned)(uintptr_t) he_rhs->data,
diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp
index 4cea988..e08f0c8 100644
--- a/src/compiler/glsl/ir_clone.cpp
+++ b/src/compiler/glsl/ir_clone.cpp
@@ -251,8 +251,6 @@ ir_texture::clone(void *mem_ctx, struct hash_table *ht) const
 ir_assignment *
 ir_assignment::clone(void *mem_ctx, struct hash_table *ht) const
 {
-   assert(this->condition == NULL);
-
    ir_assignment *cloned =
       new(mem_ctx) ir_assignment(this->lhs->clone(mem_ctx, ht),
                                  this->rhs->clone(mem_ctx, ht));
diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp
index fe9bd1d..fd0c520 100644
--- a/src/compiler/glsl/ir_constant_expression.cpp
+++ b/src/compiler/glsl/ir_constant_expression.cpp
@@ -890,19 +890,9 @@ bool ir_function_signature::constant_expression_evaluate_expression_list(void *m
          break;
       }
 
-         /* (assign [condition] (write-mask) (ref) (value)) */
+         /* (assign (write-mask) (ref) (value)) */
       case ir_type_assignment: {
          ir_assignment *asg = inst->as_assignment();
-         if (asg->condition) {
-            ir_constant *cond =
-               asg->condition->constant_expression_value(mem_ctx,
-                                                         variable_context);
-            if (!cond)
-               return false;
-            if (!cond->get_bool_component(0))
-               break;
-         }
-
          ir_constant *store = NULL;
          int offset = 0;
 
diff --git a/src/compiler/glsl/ir_hv_accept.cpp b/src/compiler/glsl/ir_hv_accept.cpp
index bf3f3d4..52abedf 100644
--- a/src/compiler/glsl/ir_hv_accept.cpp
+++ b/src/compiler/glsl/ir_hv_accept.cpp
@@ -305,9 +305,6 @@ ir_assignment::accept(ir_hierarchical_visitor *v)
    if (s != visit_continue)
       return (s == visit_continue_with_parent) ? visit_continue : s;
 
-   if (this->condition)
-      s = this->condition->accept(v);
-
    return (s == visit_stop) ? s : v->visit_leave(this);
 }
 
diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp
index ea14cde..33684d0 100644
--- a/src/compiler/glsl/ir_print_visitor.cpp
+++ b/src/compiler/glsl/ir_print_visitor.cpp
@@ -434,9 +434,6 @@ void ir_print_visitor::visit(ir_assignment *ir)
 {
    fprintf(f, "(assign ");
 
-   if (ir->condition)
-      ir->condition->accept(this);
-
    char mask[5];
    unsigned j = 0;
 
diff --git a/src/compiler/glsl/ir_rvalue_visitor.cpp b/src/compiler/glsl/ir_rvalue_visitor.cpp
index 72dd620..4096584 100644
--- a/src/compiler/glsl/ir_rvalue_visitor.cpp
+++ b/src/compiler/glsl/ir_rvalue_visitor.cpp
@@ -117,8 +117,6 @@ ir_visitor_status
 ir_rvalue_base_visitor::rvalue_visit(ir_assignment *ir)
 {
    handle_rvalue(&ir->rhs);
-   handle_rvalue(&ir->condition);
-
    return visit_continue;
 }
 
diff --git a/src/compiler/glsl/loop_analysis.cpp b/src/compiler/glsl/loop_analysis.cpp
index b9bae43..83b517f 100644
--- a/src/compiler/glsl/loop_analysis.cpp
+++ b/src/compiler/glsl/loop_analysis.cpp
@@ -52,8 +52,7 @@ loop_variable::record_reference(bool in_assignee,
    if (in_assignee) {
       assert(current_assignment != NULL);
 
-      if (in_conditional_code_or_nested_loop ||
-          current_assignment->condition != NULL) {
+      if (in_conditional_code_or_nested_loop) {
          this->conditional_or_nested_assignment = true;
       }
 
diff --git a/src/compiler/glsl/loop_controls.cpp b/src/compiler/glsl/loop_controls.cpp
index 895954f..d7d354c 100644
--- a/src/compiler/glsl/loop_controls.cpp
+++ b/src/compiler/glsl/loop_controls.cpp
@@ -67,7 +67,7 @@ find_initial_value(ir_loop *loop, ir_variable *var)
 	 ir_variable *assignee = assign->lhs->whole_variable_referenced();
 
 	 if (assignee == var)
-	    return (assign->condition != NULL) ? NULL : assign->rhs;
+	    return assign->rhs;
 
 	 break;
       }
diff --git a/src/compiler/glsl/lower_distance.cpp b/src/compiler/glsl/lower_distance.cpp
index 530f79d..31ce193 100644
--- a/src/compiler/glsl/lower_distance.cpp
+++ b/src/compiler/glsl/lower_distance.cpp
@@ -436,7 +436,7 @@ ir_visitor_status
 lower_distance_visitor::visit_leave(ir_assignment *ir)
 {
    /* First invoke the base class visitor.  This causes handle_rvalue() to be
-    * called on ir->rhs and ir->condition.
+    * called on ir->rhs.
     */
    ir_rvalue_visitor::visit_leave(ir);
 
diff --git a/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp b/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
index bfe6242..aab93aa 100644
--- a/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
+++ b/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
@@ -478,22 +478,7 @@ public:
 
       switch_generator sg(ag, index, 4, 4);
 
-      /* If the original assignment has a condition, respect that original
-       * condition!  This is acomplished by wrapping the new conditional
-       * assignments in an if-statement that uses the original condition.
-       */
-      if (orig_assign != NULL && orig_assign->condition != NULL) {
-         /* No need to clone the condition because the IR that it hangs on is
-          * going to be removed from the instruction sequence.
-          */
-         ir_if *if_stmt = new(mem_ctx) ir_if(orig_assign->condition);
-         ir_factory then_body(&if_stmt->then_instructions, body.mem_ctx);
-
-         sg.generate(0, length, then_body);
-         body.emit(if_stmt);
-      } else {
-         sg.generate(0, length, body);
-      }
+      sg.generate(0, length, body);
 
       base_ir->insert_before(&list);
       return var;
diff --git a/src/compiler/glsl/lower_vec_index_to_cond_assign.cpp b/src/compiler/glsl/lower_vec_index_to_cond_assign.cpp
index 8b71f96..a5bcb07 100644
--- a/src/compiler/glsl/lower_vec_index_to_cond_assign.cpp
+++ b/src/compiler/glsl/lower_vec_index_to_cond_assign.cpp
@@ -185,10 +185,6 @@ ir_visitor_status
 ir_vec_index_to_cond_assign_visitor::visit_leave(ir_assignment *ir)
 {
    ir->rhs = convert_vector_extract_to_cond_assign(ir->rhs);
-
-   if (ir->condition)
-      ir->condition = convert_vector_extract_to_cond_assign(ir->condition);
-
    return visit_continue;
 }
 
diff --git a/src/compiler/glsl/opt_array_splitting.cpp b/src/compiler/glsl/opt_array_splitting.cpp
index 110fccb..a948588 100644
--- a/src/compiler/glsl/opt_array_splitting.cpp
+++ b/src/compiler/glsl/opt_array_splitting.cpp
@@ -416,8 +416,6 @@ ir_array_splitting_visitor::visit_leave(ir_assignment *ir)
             new(mem_ctx) ir_dereference_array(ir->rhs->clone(mem_ctx, NULL),
                                               new(mem_ctx) ir_constant(i));
 
-         assert(ir->condition == NULL);
-
          ir_assignment *assign_i = new(mem_ctx) ir_assignment(lhs_i, rhs_i);
 
          ir->insert_before(assign_i);
@@ -435,11 +433,6 @@ ir_array_splitting_visitor::visit_leave(ir_assignment *ir)
    handle_rvalue(&ir->rhs);
    ir->rhs->accept(this);
 
-   if (ir->condition) {
-      handle_rvalue(&ir->condition);
-      ir->condition->accept(this);
-   }
-
    return visit_continue;
 }
 
diff --git a/src/compiler/glsl/opt_constant_folding.cpp b/src/compiler/glsl/opt_constant_folding.cpp
index 3b9394d..bcf88b5 100644
--- a/src/compiler/glsl/opt_constant_folding.cpp
+++ b/src/compiler/glsl/opt_constant_folding.cpp
@@ -145,23 +145,6 @@ ir_constant_folding_visitor::visit_enter(ir_assignment *ir)
    ir->rhs->accept(this);
    handle_rvalue(&ir->rhs);
 
-   if (ir->condition) {
-      ir->condition->accept(this);
-      handle_rvalue(&ir->condition);
-
-      ir_constant *const_val = ir->condition->as_constant();
-      /* If the condition is constant, either remove the condition or
-       * remove the never-executed assignment.
-       */
-      if (const_val) {
-	 if (const_val->value.b[0])
-	    ir->condition = NULL;
-	 else
-	    ir->remove();
-	 this->progress = true;
-      }
-   }
-
    /* Don't descend into the LHS because we want it to stay as a
     * variable dereference.  FINISHME: We probably should to get array
     * indices though.
diff --git a/src/compiler/glsl/opt_constant_propagation.cpp b/src/compiler/glsl/opt_constant_propagation.cpp
index 05dc71e..6913d03 100644
--- a/src/compiler/glsl/opt_constant_propagation.cpp
+++ b/src/compiler/glsl/opt_constant_propagation.cpp
@@ -481,9 +481,6 @@ ir_constant_propagation_visitor::add_constant(ir_assignment *ir)
 {
    acp_entry *entry;
 
-   if (ir->condition)
-      return;
-
    if (!ir->write_mask)
       return;
 
diff --git a/src/compiler/glsl/opt_constant_variable.cpp b/src/compiler/glsl/opt_constant_variable.cpp
index 914b460..30fdc00 100644
--- a/src/compiler/glsl/opt_constant_variable.cpp
+++ b/src/compiler/glsl/opt_constant_variable.cpp
@@ -116,9 +116,6 @@ ir_constant_variable_visitor::visit_enter(ir_assignment *ir)
    /* OK, now find if we actually have all the right conditions for
     * this to be a constant value assigned to the var.
     */
-   if (ir->condition)
-      return visit_continue;
-
    ir_variable *var = ir->whole_variable_written();
    if (!var)
       return visit_continue;
diff --git a/src/compiler/glsl/opt_copy_propagation.cpp b/src/compiler/glsl/opt_copy_propagation.cpp
index b8ef0de0..301a2af 100644
--- a/src/compiler/glsl/opt_copy_propagation.cpp
+++ b/src/compiler/glsl/opt_copy_propagation.cpp
@@ -342,9 +342,6 @@ ir_copy_propagation_visitor::kill(ir_variable *var)
 void
 ir_copy_propagation_visitor::add_copy(ir_assignment *ir)
 {
-   if (ir->condition)
-      return;
-
    ir_variable *lhs_var = ir->whole_variable_written();
    ir_variable *rhs_var = ir->rhs->whole_variable_referenced();
 
diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp b/src/compiler/glsl/opt_copy_propagation_elements.cpp
index 9f79fa9..a687c4e 100644
--- a/src/compiler/glsl/opt_copy_propagation_elements.cpp
+++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp
@@ -546,9 +546,6 @@ ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir)
    int orig_swizzle[4] = {0, 1, 2, 3};
    int swizzle[4];
 
-   if (ir->condition)
-      return;
-
    ir_dereference_variable *lhs = ir->lhs->as_dereference_variable();
    if (!lhs || !(lhs->type->is_scalar() || lhs->type->is_vector()))
       return;
diff --git a/src/compiler/glsl/opt_dead_builtin_varyings.cpp b/src/compiler/glsl/opt_dead_builtin_varyings.cpp
index 4526f2b..d0b57da 100644
--- a/src/compiler/glsl/opt_dead_builtin_varyings.cpp
+++ b/src/compiler/glsl/opt_dead_builtin_varyings.cpp
@@ -487,7 +487,6 @@ public:
    virtual ir_visitor_status visit_leave(ir_assignment *ir)
    {
       handle_rvalue(&ir->rhs);
-      handle_rvalue(&ir->condition);
 
       /* We have to use set_lhs when changing the LHS of an assignment. */
       ir_rvalue *lhs = ir->lhs;
diff --git a/src/compiler/glsl/opt_dead_code_local.cpp b/src/compiler/glsl/opt_dead_code_local.cpp
index 3cbc441..1de281a 100644
--- a/src/compiler/glsl/opt_dead_code_local.cpp
+++ b/src/compiler/glsl/opt_dead_code_local.cpp
@@ -173,22 +173,17 @@ process_assignment(void *lin_ctx, ir_assignment *ir, exec_list *assignments)
    bool progress = false;
    kill_for_derefs_visitor v(assignments);
 
-   if (ir->condition == NULL) {
-      /* If this is an assignment of the form "foo = foo;", remove the whole
-       * instruction and be done with it.
-       */
-      const ir_variable *const lhs_var = ir->whole_variable_written();
-      if (lhs_var != NULL && lhs_var == ir->rhs->whole_variable_referenced()) {
-         ir->remove();
-         return true;
-      }
+   /* If this is an assignment of the form "foo = foo;", remove the whole
+    * instruction and be done with it.
+    */
+   const ir_variable *const lhs_var = ir->whole_variable_written();
+   if (lhs_var != NULL && lhs_var == ir->rhs->whole_variable_referenced()) {
+      ir->remove();
+      return true;
    }
 
    /* Kill assignment entries for things used to produce this assignment. */
    ir->rhs->accept(&v);
-   if (ir->condition) {
-      ir->condition->accept(&v);
-   }
 
    /* Kill assignment enties used as array indices.
     */
@@ -197,7 +192,6 @@ process_assignment(void *lin_ctx, ir_assignment *ir, exec_list *assignments)
    assert(var);
 
    /* Now, check if we did a whole-variable assignment. */
-   if (!ir->condition) {
       ir_dereference_variable *deref_var = ir->lhs->as_dereference_variable();
 
       /* If it's a vector type, we can do per-channel elimination of
@@ -285,7 +279,6 @@ process_assignment(void *lin_ctx, ir_assignment *ir, exec_list *assignments)
 	    }
 	 }
       }
-   }
 
    /* Add this instruction to the assignment list available to be removed. */
    assignment_entry *entry = new(lin_ctx) assignment_entry(var, ir);
diff --git a/src/compiler/glsl/opt_structure_splitting.cpp b/src/compiler/glsl/opt_structure_splitting.cpp
index f7562df..5dc90e1 100644
--- a/src/compiler/glsl/opt_structure_splitting.cpp
+++ b/src/compiler/glsl/opt_structure_splitting.cpp
@@ -160,8 +160,7 @@ ir_structure_reference_visitor::visit_enter(ir_assignment *ir)
       return visit_continue_with_parent;
 
    if (ir->lhs->as_dereference_variable() &&
-       ir->rhs->as_dereference_variable() &&
-       !ir->condition) {
+       ir->rhs->as_dereference_variable()) {
       /* We'll split copies of a structure to copies of components, so don't
        * descend to the ir_dereference_variables.
        */
@@ -264,7 +263,7 @@ ir_structure_splitting_visitor::visit_leave(ir_assignment *ir)
    variable_entry *rhs_entry = rhs_deref ? get_splitting_entry(rhs_deref->var) : NULL;
    const glsl_type *type = ir->rhs->type;
 
-   if ((lhs_entry || rhs_entry) && !ir->condition) {
+   if (lhs_entry || rhs_entry) {
       for (unsigned int i = 0; i < type->length; i++) {
 	 ir_dereference *new_lhs, *new_rhs;
 	 void *mem_ctx = lhs_entry ? lhs_entry->mem_ctx : rhs_entry->mem_ctx;
@@ -293,8 +292,6 @@ ir_structure_splitting_visitor::visit_leave(ir_assignment *ir)
       split_deref(&ir->lhs);
    }
 
-   handle_rvalue(&ir->condition);
-
    return visit_continue;
 }
 
diff --git a/src/compiler/glsl/opt_tree_grafting.cpp b/src/compiler/glsl/opt_tree_grafting.cpp
index 6b5d93a..1c64f24 100644
--- a/src/compiler/glsl/opt_tree_grafting.cpp
+++ b/src/compiler/glsl/opt_tree_grafting.cpp
@@ -177,8 +177,7 @@ ir_tree_grafting_visitor::check_graft(ir_instruction *ir, ir_variable *var)
 ir_visitor_status
 ir_tree_grafting_visitor::visit_leave(ir_assignment *ir)
 {
-   if (do_graft(&ir->rhs) ||
-       do_graft(&ir->condition))
+   if (do_graft(&ir->rhs))
       return visit_stop;
 
    /* If this assignment updates a variable used in the assignment
diff --git a/src/compiler/glsl/opt_vectorize.cpp b/src/compiler/glsl/opt_vectorize.cpp
index 88318cd..e2cda8a 100644
--- a/src/compiler/glsl/opt_vectorize.cpp
+++ b/src/compiler/glsl/opt_vectorize.cpp
@@ -257,8 +257,7 @@ ir_vectorize_visitor::visit_enter(ir_assignment *ir)
    ir_rvalue *rhs = this->last_assignment != NULL ?
                     this->last_assignment->rhs : NULL;
 
-   if (ir->condition ||
-       this->channels >= 4 ||
+   if (this->channels >= 4 ||
        !single_channel_write_mask(ir->write_mask) ||
        this->assignment[write_mask_to_swizzle(ir->write_mask)] != NULL ||
        (lhs && !ir->lhs->equals(lhs)) ||
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 03d615f..db9eacf 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1871,27 +1871,11 @@ ir_to_mesa_visitor::visit(ir_assignment *ir)
    assert(l.file != PROGRAM_UNDEFINED);
    assert(r.file != PROGRAM_UNDEFINED);
 
-   if (ir->condition) {
-      const bool switch_order = this->process_move_condition(ir->condition);
-      src_reg condition = this->result;
-
-      for (i = 0; i < type_size(ir->lhs->type); i++) {
-	 if (switch_order) {
-	    emit(ir, OPCODE_CMP, l, condition, src_reg(l), r);
-	 } else {
-	    emit(ir, OPCODE_CMP, l, condition, r, src_reg(l));
-	 }
-
-	 l.index++;
-	 r.index++;
-      }
-   } else {
       for (i = 0; i < type_size(ir->lhs->type); i++) {
 	 emit(ir, OPCODE_MOV, l, r);
 	 l.index++;
 	 r.index++;
       }
-   }
 }
 
 
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index b49590b..b32e7b7 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2996,17 +2996,12 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
    assert(l.file != PROGRAM_UNDEFINED);
    assert(r.file != PROGRAM_UNDEFINED);
 
-   if (ir->condition) {
-      const bool switch_order = this->process_move_condition(ir->condition);
-      st_src_reg condition = this->result;
-
-      emit_block_mov(ir, ir->lhs->type, &l, &r, &condition, switch_order);
-   } else if (ir->rhs->as_expression() &&
-              this->instructions.get_tail() &&
-              ir->rhs == ((glsl_to_tgsi_instruction *)this->instructions.get_tail())->ir &&
-              !((glsl_to_tgsi_instruction *)this->instructions.get_tail())->is_64bit_expanded &&
-              type_size(ir->lhs->type) == 1 &&
-              l.writemask == ((glsl_to_tgsi_instruction *)this->instructions.get_tail())->dst[0].writemask) {
+   if (ir->rhs->as_expression() &&
+       this->instructions.get_tail() &&
+       ir->rhs == ((glsl_to_tgsi_instruction *)this->instructions.get_tail())->ir &&
+       !((glsl_to_tgsi_instruction *)this->instructions.get_tail())->is_64bit_expanded &&
+       type_size(ir->lhs->type) == 1 &&
+       l.writemask == ((glsl_to_tgsi_instruction *)this->instructions.get_tail())->dst[0].writemask) {
       /* To avoid emitting an extra MOV when assigning an expression to a
        * variable, emit the last instruction of the expression again, but
        * replace the destination register with the target of the assignment.
-- 
2.9.5



More information about the mesa-dev mailing list