diff options
author | Tilman Sauerbeck <tilman@code-monkey.de> | 2010-09-17 18:50:07 +0200 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2010-09-18 01:28:47 +0200 |
commit | 19f8f32a967fbe376ca0aae9be12100f4cdf9d31 (patch) | |
tree | 705ccf49a6849672c2bf53b5beed759c1156fe77 /src/glsl | |
parent | da3db66c08cbc74f34d2fb6067ae02ceb86007b3 (diff) |
glsl2: Empty functions can be inlined.
Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ir_function_can_inline.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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; |