aboutsummaryrefslogtreecommitdiffstats
path: root/glsl_parser_extras.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-04-16 16:43:47 -0700
committerEric Anholt <[email protected]>2010-04-19 15:33:52 -0700
commit7d21104a8b92c139051e9a224c5d863802a8ade6 (patch)
tree9fbd9d256c6bd64063439c0adfbd95ec5561a64d /glsl_parser_extras.cpp
parent71df19f5ef6e78beb5160801f81468184b75447e (diff)
Remove dead code assignments and variable declarations.
This pass only works on assignments where the variable is never referenced. There is no code flow analysis, so it can't do a better job of avoiding redundant assignments. For now, the optimizer only does do_dead_code_unlinked(), so it won't trim the builtin variable list or initializers outside of the scope of functions. This is because we don't have the visibility into other functions that might get linked in in order to eliminate work on global variables.
Diffstat (limited to 'glsl_parser_extras.cpp')
-rw-r--r--glsl_parser_extras.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp
index 455bf0c7a4a..f7ee891eeb6 100644
--- a/glsl_parser_extras.cpp
+++ b/glsl_parser_extras.cpp
@@ -35,6 +35,7 @@
#include "glsl_parser_extras.h"
#include "glsl_parser.h"
#include "ir_constant_folding.h"
+#include "ir_dead_code.h"
#include "ir_function_inlining.h"
#include "ir_if_simplification.h"
#include "ir_print_visitor.h"
@@ -761,6 +762,7 @@ main(int argc, char **argv)
progress = do_function_inlining(&instructions) || progress;
progress = do_if_simplification(&instructions) || progress;
+ progress = do_dead_code_unlinked(&instructions) || progress;
/* Constant folding */
ir_constant_folding_visitor constant_folding;