From 1a872b1af37927d689ec7af0921af7f3a9dcb1fd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 9 Jun 2010 17:31:02 -0700 Subject: [PATCH] Do simple constant folding while processing function call parameters --- ast_function.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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++; -- 2.30.2