summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 1fff7175395..814f6e61f1c 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 1f51da6e4ff..9dca0ff8e76 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 387db642354..efa3afda35a 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 238a1a75eea..8541d9a8ee1 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 88dcdc25176..f67b4633740 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.
*/