glsl: Remove extra checks for constant true assignment conditions.
authorEric Anholt <eric@anholt.net>
Sat, 29 Jan 2011 21:59:14 +0000 (07:59 +1000)
committerEric Anholt <eric@anholt.net>
Fri, 4 Feb 2011 18:18:38 +0000 (12:18 -0600)
These are already stripped by opt_constant_folding.cpp.

src/glsl/opt_constant_propagation.cpp
src/glsl/opt_constant_variable.cpp
src/glsl/opt_copy_propagation.cpp
src/glsl/opt_copy_propagation_elements.cpp
src/glsl/opt_dead_code_local.cpp

index 1fff7175395c7220acee4e7049f45dd4a283d202..814f6e61f1c3d9e17d8760a58771c93b694457e9 100644 (file)
@@ -400,11 +400,8 @@ ir_constant_propagation_visitor::add_constant(ir_assignment *ir)
 {
    acp_entry *entry;
 
-   if (ir->condition) {
-      ir_constant *condition = ir->condition->as_constant();
-      if (!condition || !condition->value.b[0])
-        return;
-   }
+   if (ir->condition)
+      return;
 
    if (!ir->write_mask)
       return;
index 1f51da6e4ff86eda3c142d5e33663eaf69484b0c..9dca0ff8e76e85a6907f3f0d87c5a54f484a2978 100644 (file)
@@ -107,11 +107,8 @@ 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) {
-      constval = ir->condition->constant_expression_value();
-      if (!constval || !constval->value.b[0])
-        return visit_continue;
-   }
+   if (ir->condition)
+      return visit_continue;
 
    ir_variable *var = ir->whole_variable_written();
    if (!var)
index 387db6423541efcbe75a994994e1a2e845822d5c..efa3afda35aefe40f19e45bc8fe208b499aee1bc 100644 (file)
@@ -309,11 +309,8 @@ ir_copy_propagation_visitor::add_copy(ir_assignment *ir)
 {
    acp_entry *entry;
 
-   if (ir->condition) {
-      ir_constant *condition = ir->condition->as_constant();
-      if (!condition || !condition->value.b[0])
-        return;
-   }
+   if (ir->condition)
+      return;
 
    ir_variable *lhs_var = ir->whole_variable_written();
    ir_variable *rhs_var = ir->rhs->whole_variable_referenced();
index 238a1a75eeae226e277565b301d492b98c50020e..8541d9a8ee1ca80904b1e261047242211a844f84 100644 (file)
@@ -409,11 +409,8 @@ ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir)
    int orig_swizzle[4] = {0, 1, 2, 3};
    int swizzle[4];
 
-   if (ir->condition) {
-      ir_constant *condition = ir->condition->as_constant();
-      if (!condition || !condition->value.b[0])
-        return;
-   }
+   if (ir->condition)
+      return;
 
    ir_dereference_variable *lhs = ir->lhs->as_dereference_variable();
    if (!lhs || !(lhs->type->is_scalar() || lhs->type->is_vector()))
index 88dcdc25176602c4f65efcb5d15db2b132e0c2e3..f67b4633740c185618921ea6643dee911aab9b90 100644 (file)
@@ -131,15 +131,8 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments)
    var = ir->lhs->variable_referenced();
    assert(var);
 
-   bool always_assign = true;
-   if (ir->condition) {
-      ir_constant *condition = ir->condition->as_constant();
-      if (!condition || !condition->value.b[0])
-        always_assign = false;
-   }
-
    /* Now, check if we did a whole-variable assignment. */
-   if (always_assign && (ir->whole_variable_written() != NULL)) {
+   if (!ir->condition && (ir->whole_variable_written() != NULL)) {
       /* We did a whole-variable assignment.  So, any instruction in
        * the assignment list with the same LHS is dead.
        */