summaryrefslogtreecommitdiff
path: root/src/glsl
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-01-30 07:59:14 +1000
committerEric Anholt <eric@anholt.net>2011-02-04 12:18:38 -0600
commit29a2e9133e415de8b010df5b80db758aaf1007a6 (patch)
tree146ef5788bce45b707b983caac8d8f74d41f9814 /src/glsl
parentb6d49ab843ff7ee989e99bb28a36eb53f704c879 (diff)
glsl: Remove extra checks for constant true assignment conditions.
These are already stripped by opt_constant_folding.cpp.
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/opt_constant_propagation.cpp7
-rw-r--r--src/glsl/opt_constant_variable.cpp7
-rw-r--r--src/glsl/opt_copy_propagation.cpp7
-rw-r--r--src/glsl/opt_copy_propagation_elements.cpp7
-rw-r--r--src/glsl/opt_dead_code_local.cpp9
5 files changed, 9 insertions, 28 deletions
diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp
index 1fff717539..814f6e61f1 100644
--- a/src/glsl/opt_constant_propagation.cpp
+++ b/src/glsl/opt_constant_propagation.cpp
@@ -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;
diff --git a/src/glsl/opt_constant_variable.cpp b/src/glsl/opt_constant_variable.cpp
index 1f51da6e4f..9dca0ff8e7 100644
--- a/src/glsl/opt_constant_variable.cpp
+++ b/src/glsl/opt_constant_variable.cpp
@@ -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)
diff --git a/src/glsl/opt_copy_propagation.cpp b/src/glsl/opt_copy_propagation.cpp
index 387db64235..efa3afda35 100644
--- a/src/glsl/opt_copy_propagation.cpp
+++ b/src/glsl/opt_copy_propagation.cpp
@@ -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();
diff --git a/src/glsl/opt_copy_propagation_elements.cpp b/src/glsl/opt_copy_propagation_elements.cpp
index 238a1a75ee..8541d9a8ee 100644
--- a/src/glsl/opt_copy_propagation_elements.cpp
+++ b/src/glsl/opt_copy_propagation_elements.cpp
@@ -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()))
diff --git a/src/glsl/opt_dead_code_local.cpp b/src/glsl/opt_dead_code_local.cpp
index 88dcdc2517..f67b463374 100644
--- a/src/glsl/opt_dead_code_local.cpp
+++ b/src/glsl/opt_dead_code_local.cpp
@@ -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.
*/