radv: move nir_opt_conditional_discard out of optimization loop
authorDaniel Schürmann <daniel@schuermann.dev>
Sat, 20 Jul 2019 17:21:14 +0000 (19:21 +0200)
committerDaniel Schürmann <daniel@schuermann.dev>
Mon, 22 Jul 2019 06:12:18 +0000 (08:12 +0200)
This late optimization pass is only affected by nir_opt_if() and handles all cases
in a single pass. It's enough to call it once after the optimization loop.
No changes on vkpipeline-db.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_shader.c

index 4262dae28607bbe120946476ebc97904c26d2e21..3adaf52e1523bd933cc6b5c005c3ca8958408adb 100644 (file)
@@ -194,12 +194,12 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively,
                 }
 
                 NIR_PASS(progress, shader, nir_opt_undef);
-                NIR_PASS(progress, shader, nir_opt_conditional_discard);
                 if (shader->options->max_unroll_iterations) {
                         NIR_PASS(progress, shader, nir_opt_loop_unroll, 0);
                 }
         } while (progress && !optimize_conservatively);
 
+       NIR_PASS(progress, shader, nir_opt_conditional_discard);
         NIR_PASS(progress, shader, nir_opt_shrink_load);
         NIR_PASS(progress, shader, nir_opt_move_load_ubo);
 }