From: Eric Anholt Date: Tue, 6 Apr 2010 17:07:20 +0000 (-0700) Subject: Fold constant expressions in if conditionals. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3fff009af169313fa22996d93ad195cf12729763;p=mesa.git Fold constant expressions in if conditionals. Fixes up 3 more expressions in CorrectParse2.frag. --- diff --git a/ir_constant_folding.cpp b/ir_constant_folding.cpp index 306f211fe56..b9dee37edfb 100644 --- a/ir_constant_folding.cpp +++ b/ir_constant_folding.cpp @@ -127,5 +127,9 @@ ir_constant_folding_visitor::visit(ir_return *ir) void ir_constant_folding_visitor::visit(ir_if *ir) { - (void) ir; + ir_constant *const_val = ir->condition->constant_expression_value(); + if (const_val) + ir->condition = const_val; + else + ir->condition->accept(this); }