Mesa (glsl2): ir_to_mesa: Don't do function inlining until linking.

Eric Anholt anholt at
Thu Aug 5 10:23:44 PDT 2010

Module: Mesa
Branch: glsl2
Commit: e995f0e10c9ee51f7c8f8fa2193ff99e1b49e40d

Author: Eric Anholt <eric at>
Date:   Thu Aug  5 10:13:10 2010 -0700

ir_to_mesa: Don't do function inlining until linking.

Optimizations at compile time should generally be done with the goal
of reducing instruction count so that other work, particularly
linking, is less time-consuming if the shader is used multiple times.
However, function inlining increases instruction count for the inlined
function bodies without removing the original function body, since we
don't know if it will be used at link time or not.

Reduces the runtime of linking and executing a Yo Frankie fragment
shader from 0.9 seconds to 0.5 seconds (-45.9%, +/- 2.2%, n=5).


 src/mesa/program/ir_to_mesa.cpp |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 74996ae..299b11d 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2604,7 +2604,6 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
       do {
 	 progress = false;
-	 progress = do_function_inlining(shader->ir) || progress;
 	 progress = do_if_simplification(shader->ir) || progress;
 	 progress = do_copy_propagation(shader->ir) || progress;
 	 progress = do_dead_code_local(shader->ir) || progress;

More information about the mesa-commit mailing list