summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-03-11 14:08:48 -0800
committerEric Anholt <eric@anholt.net>2011-03-15 10:14:51 -0700
commitc75427f4c8767e131e5fb3de44fbc9d904cb992d (patch)
treebf8b3c9d66f5352b12722f9cd1b20743025caef9
parent11af045ea8080435de0be74d8765190287b64f8b (diff)
glsl: Skip processing the first function's body in do_dead_functions().
It can't call anything, so there's no point.
-rw-r--r--src/glsl/opt_dead_functions.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/glsl/opt_dead_functions.cpp b/src/glsl/opt_dead_functions.cpp
index 51c77e3b94..7c64c618c0 100644
--- a/src/glsl/opt_dead_functions.cpp
+++ b/src/glsl/opt_dead_functions.cpp
@@ -50,6 +50,7 @@ public:
ir_dead_functions_visitor()
{
this->mem_ctx = ralloc_context(NULL);
+ this->seen_another_function_signature = false;
}
~ir_dead_functions_visitor()
@@ -64,6 +65,8 @@ public:
bool (*predicate)(ir_instruction *ir);
+ bool seen_another_function_signature;
+
/* List of signature_entry */
exec_list signature_list;
void *mem_ctx;
@@ -94,7 +97,13 @@ ir_dead_functions_visitor::visit_enter(ir_function_signature *ir)
entry->used = true;
}
-
+ /* If this is the first signature to look at, no need to descend to see
+ * if it has calls to another function signature.
+ */
+ if (!this->seen_another_function_signature) {
+ this->seen_another_function_signature = true;
+ return visit_continue_with_parent;
+ }
return visit_continue;
}