glsl: Don't constant-fold the condition of an assignment

At this point, this should always be NULL.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14573>
This commit is contained in:
Ian Romanick
2022-01-14 18:17:42 -08:00
committed by Marge Bot
parent 697a460e49
commit ec5c9649ba
@@ -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.