From: Tilman Sauerbeck Date: Fri, 17 Sep 2010 16:50:07 +0000 (+0200) Subject: glsl2: Empty functions can be inlined. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=19f8f32a967fbe376ca0aae9be12100f4cdf9d31;p=mesa.git glsl2: Empty functions can be inlined. Signed-off-by: Tilman Sauerbeck Signed-off-by: Kenneth Graunke --- diff --git a/src/glsl/ir_function_can_inline.cpp b/src/glsl/ir_function_can_inline.cpp index 8bb8e0d9ed7..f29f277ef4b 100644 --- a/src/glsl/ir_function_can_inline.cpp +++ b/src/glsl/ir_function_can_inline.cpp @@ -63,8 +63,11 @@ can_inline(ir_call *call) v.run((exec_list *) &callee->body); + /* If the function is empty (no last instruction) or does not end with a + * return statement, we need to count the implicit return. + */ ir_instruction *last = (ir_instruction *)callee->body.get_tail(); - if (last && !last->as_return()) + if (last == NULL || !last->as_return()) v.num_returns++; return v.num_returns == 1;