Mesa (master): glsl2: Empty functions can be inlined.
Kenneth Graunke
kwg at kemper.freedesktop.org
Fri Sep 17 23:36:26 UTC 2010
Module: Mesa
Branch: master
Commit: 19f8f32a967fbe376ca0aae9be12100f4cdf9d31
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=19f8f32a967fbe376ca0aae9be12100f4cdf9d31
Author: Tilman Sauerbeck <tilman at code-monkey.de>
Date: Fri Sep 17 18:50:07 2010 +0200
glsl2: Empty functions can be inlined.
Signed-off-by: Tilman Sauerbeck <tilman at code-monkey.de>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
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 8bb8e0d..f29f277 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;
More information about the mesa-commit
mailing list