From: Ian Romanick Date: Thu, 10 Jun 2010 00:31:02 +0000 (-0700) Subject: Do simple constant folding while processing function call parameters X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a872b1af37927d689ec7af0921af7f3a9dcb1fd;p=mesa.git Do simple constant folding while processing function call parameters --- diff --git a/ast_function.cpp b/ast_function.cpp index f0c1f0409a0..b0700bed5f9 100644 --- a/ast_function.cpp +++ b/ast_function.cpp @@ -36,7 +36,11 @@ process_parameters(exec_list *instructions, exec_list *actual_parameters, foreach_list (n, parameters) { ast_node *const ast = exec_node_data(ast_node, n, link); - ir_rvalue *const result = ast->hir(instructions, state); + ir_rvalue *result = ast->hir(instructions, state); + + ir_constant *const constant = result->constant_expression_value(); + if (constant != NULL) + result = constant; actual_parameters->push_tail(result); count++;