summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-11-11 16:12:32 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:19:01 -0800
commit20adc516e27e390b1558703720a2a2129c9e8ad5 (patch)
tree4cb38edb8a71cb3c56554e5a77abf293216a6552
parent6bdce55c44a45fc8ec8426996572c18ecf88bd64 (diff)
i965/fs_nir: Add the CSE pass and actually run in a loop
Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 9141dc68196..2ca2e738b9f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -54,25 +54,30 @@ fs_visitor::emit_nir_code()
if (1)
nir_print_shader(nir, stderr);
- if (1) {
- nir_convert_to_ssa(nir);
+ nir_convert_to_ssa(nir);
+ nir_validate_shader(nir);
+
+ bool progress;
+ do {
+ progress = false;
+ progress |= nir_copy_prop(nir);
nir_validate_shader(nir);
- nir_copy_prop(nir);
+ progress |= nir_opt_dce(nir);
nir_validate_shader(nir);
- nir_opt_dce(nir);
+ progress |= nir_opt_cse(nir);
nir_validate_shader(nir);
- nir_opt_peephole_select(nir);
+ progress |= nir_opt_peephole_select(nir);
nir_validate_shader(nir);
- nir_opt_peephole_ffma(nir);
+ progress |= nir_opt_peephole_ffma(nir);
nir_validate_shader(nir);
- nir_print_shader(nir, stderr);
+ } while (progress);
+ nir_print_shader(nir, stderr);
- nir_convert_from_ssa(nir);
- nir_print_shader(nir, stderr);
- nir_validate_shader(nir);
- nir_lower_vec_to_movs(nir);
- nir_validate_shader(nir);
- }
+ nir_convert_from_ssa(nir);
+ nir_validate_shader(nir);
+ nir_print_shader(nir, stderr);
+ nir_lower_vec_to_movs(nir);
+ nir_validate_shader(nir);
/* emit the arrays used for inputs and outputs - load/store intrinsics will
* be converted to reads/writes of these arrays