summaryrefslogtreecommitdiff
path: root/src/glsl/Makefile.sources
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2013-04-03 23:56:57 -0700
committerKenneth Graunke <kenneth@whitecape.org>2013-04-04 15:38:19 -0700
commitedc52a8f280db8d9dc9a04314741319ea8b83e67 (patch)
treeae9866c0c13ccfec896c5dd1ed433ad22956cced /src/glsl/Makefile.sources
parent967514ce680f7bf785ab544c6174786dd20425de (diff)
glsl: Add an optimization pass to flatten simple nested if blocks.
GLBenchmark 2.7's shaders contain conditional blocks like: if (x) { if (y) { ... } } where the outer conditional's then clause contains exactly one statement (the nested if) and there are no else clauses. This can easily be optimized into: if (x && y) { ... } This saves a few instructions in GLBenchmark 2.7: total instructions in shared programs: 11833 -> 11649 (-1.55%) instructions in affected programs: 8234 -> 8050 (-2.23%) It also helps CS:GO slightly (-0.05%/-0.22%). More importantly, however, it simplifies the control flow graph, which could enable other optimizations. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/glsl/Makefile.sources')
-rw-r--r--src/glsl/Makefile.sources1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index c294aa4296c..b5282a6041e 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -80,6 +80,7 @@ LIBGLSL_FILES = \
$(GLSL_SRCDIR)/opt_dead_code.cpp \
$(GLSL_SRCDIR)/opt_dead_code_local.cpp \
$(GLSL_SRCDIR)/opt_dead_functions.cpp \
+ $(GLSL_SRCDIR)/opt_flatten_nested_if_blocks.cpp \
$(GLSL_SRCDIR)/opt_function_inlining.cpp \
$(GLSL_SRCDIR)/opt_if_simplification.cpp \
$(GLSL_SRCDIR)/opt_noop_swizzle.cpp \