aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-03-23 17:11:49 -0700
committerJason Ekstrand <[email protected]>2015-04-01 12:51:03 -0700
commitda294f9b2f666f487001b2a25627c867c40eb3d9 (patch)
tree806d9acaaf59922c3947837fe0611c5c74e90bcc
parent1779dc060fa8d55d979f887e41f1ec2c793859b7 (diff)
nir/algebraic: Add a seperate section for "late" optimizations
i965/nir: Use the late optimizations Reviewed-by: Matt Turner <[email protected]>
-rw-r--r--src/glsl/nir/nir.h1
-rw-r--r--src/glsl/nir/nir_opt_algebraic.py9
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp3
3 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 7b886e3d36f..24deb82d2e7 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1613,6 +1613,7 @@ void nir_convert_to_ssa(nir_shader *shader);
void nir_convert_from_ssa(nir_shader *shader);
bool nir_opt_algebraic(nir_shader *shader);
+bool nir_opt_algebraic_late(nir_shader *shader);
bool nir_opt_constant_folding(nir_shader *shader);
bool nir_opt_global_to_local(nir_shader *shader);
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index ddf78be7721..2079235b351 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -195,4 +195,13 @@ for op in ['flt', 'fge', 'feq', 'fne',
('bcsel', 'a', (op, 'd', 'b'), (op, 'd', 'c'))),
]
+# This section contains "late" optimizations that should be run after the
+# regular optimizations have finished. Optimizations should go here if
+# they help code generation but do not necessarily produce code that is
+# more easily optimizable.
+late_optimizations = [
+]
+
print nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render()
+print nir_algebraic.AlgebraicPass("nir_opt_algebraic_late",
+ late_optimizations).render()
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 21e52fe0e45..204e713ea55 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -147,6 +147,9 @@ fs_visitor::emit_nir_code()
nir_optimize(nir);
+ nir_opt_algebraic_late(nir);
+ nir_validate_shader(nir);
+
nir_lower_locals_to_regs(nir);
nir_validate_shader(nir);