summaryrefslogtreecommitdiffstats
path: root/ir_function_inlining.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ir_function_inlining.cpp')
-rw-r--r--ir_function_inlining.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/ir_function_inlining.cpp b/ir_function_inlining.cpp
index e03673e632d..af6a477d9b4 100644
--- a/ir_function_inlining.cpp
+++ b/ir_function_inlining.cpp
@@ -31,6 +31,7 @@
#include "ir.h"
#include "ir_visitor.h"
#include "ir_function_inlining.h"
+#include "ir_expression_flattening.h"
#include "glsl_types.h"
class variable_remap : public exec_node {
@@ -305,10 +306,23 @@ can_inline(ir_call *call)
}
bool
+automatic_inlining_predicate(ir_instruction *ir)
+{
+ ir_call *call = ir->as_call();
+
+ if (call && can_inline(call))
+ return true;
+
+ return false;
+}
+
+bool
do_function_inlining(exec_list *instructions)
{
bool progress = false;
+ do_expression_flattening(instructions, automatic_inlining_predicate);
+
foreach_iter(exec_list_iterator, iter, *instructions) {
ir_instruction *ir = (ir_instruction *)iter.get();
ir_assignment *assign = ir->as_assignment();