From: Eric Anholt Date: Thu, 8 Apr 2010 20:42:48 +0000 (-0700) Subject: Repeat the optimization passes until we stop making progress. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2a7b2b22f47661029a1e8eea3d3765bd782412b3;p=mesa.git Repeat the optimization passes until we stop making progress. --- diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index a4a67c88bcb..38dee95c359 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -754,11 +754,16 @@ main(int argc, char **argv) /* Optimization passes */ if (!state.error) { - do_function_inlining(&instructions); + bool progress; + do { + progress = false; - /* Constant folding */ - ir_constant_folding_visitor constant_folding; - visit_exec_list(&instructions, &constant_folding); + progress = do_function_inlining(&instructions) || progress; + + /* Constant folding */ + ir_constant_folding_visitor constant_folding; + visit_exec_list(&instructions, &constant_folding); + } while (progress); } /* Print out the resulting IR */ diff --git a/ir_function_inlining.cpp b/ir_function_inlining.cpp index 40f82513095..e03673e632d 100644 --- a/ir_function_inlining.cpp +++ b/ir_function_inlining.cpp @@ -307,7 +307,7 @@ can_inline(ir_call *call) bool do_function_inlining(exec_list *instructions) { - bool progress; + bool progress = false; foreach_iter(exec_list_iterator, iter, *instructions) { ir_instruction *ir = (ir_instruction *)iter.get();