Module: Mesa
Branch: main
Commit: a3ed36da1a321a6d4f65a774622767bababe8f16
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3ed36da1a321a6d4f65a774622767bababe8f16

Author: Daniel Schürmann <dan...@schuermann.dev>
Date:   Tue Aug  8 12:27:41 2023 +0200

treewide: replace calls to nir_opt_trivial_continues() with nir_opt_loop()

Totals from 850 (1.11% of 76636) affected shaders: (RADV, GFX11)
MaxWaves: 18134 -> 18130 (-0.02%)
Instrs: 3011298 -> 3008585 (-0.09%); split: -0.17%, +0.08%
CodeSize: 15836804 -> 15841972 (+0.03%); split: -0.09%, +0.12%
VGPRs: 63580 -> 63604 (+0.04%)
SpillSGPRs: 966 -> 1148 (+18.84%); split: -0.83%, +19.67%
Latency: 36102291 -> 30186144 (-16.39%); split: -16.41%, +0.02%
InvThroughput: 9058100 -> 7011821 (-22.59%); split: -22.61%, +0.02%
VClause: 65369 -> 65364 (-0.01%); split: -0.03%, +0.02%
SClause: 100309 -> 100305 (-0.00%); split: -0.04%, +0.04%
Copies: 335658 -> 336472 (+0.24%); split: -0.70%, +0.94%
Branches: 110806 -> 108945 (-1.68%); split: -1.94%, +0.26%
PreSGPRs: 73476 -> 73934 (+0.62%); split: -0.25%, +0.87%
PreVGPRs: 58809 -> 58840 (+0.05%); split: -0.01%, +0.06%

Reviewed-by: Konstantin Seurer <konstantin.seu...@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24940>

---

 src/amd/vulkan/radv_shader.c                       |  6 +++---
 src/broadcom/compiler/nir_to_vir.c                 |  2 +-
 src/compiler/glsl/gl_nir_linker.c                  |  2 +-
 src/freedreno/ir3/ir3_nir.c                        |  4 ++--
 src/gallium/auxiliary/nir/nir_to_tgsi.c            |  2 +-
 src/gallium/auxiliary/nir/tgsi_to_nir.c            |  2 +-
 src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c |  4 ++--
 src/gallium/drivers/freedreno/a2xx/ir2_nir.c       |  4 ++--
 src/gallium/drivers/i915/i915_screen.c             |  2 +-
 src/gallium/drivers/r300/compiler/r300_nir.c       |  2 +-
 src/gallium/drivers/r600/sfn/sfn_nir.cpp           |  2 +-
 src/gallium/drivers/radeonsi/si_shader_nir.c       |  2 +-
 src/gallium/frontends/lavapipe/lvp_pipeline.c      | 10 +++++-----
 src/intel/compiler/brw_nir.c                       |  4 ++--
 src/microsoft/spirv_to_dxil/dxil_spirv_nir.c       |  2 +-
 src/nouveau/codegen/nv50_ir_from_nir.cpp           |  2 +-
 src/nouveau/compiler/nak_nir.c                     |  8 ++++----
 src/nouveau/vulkan/nvk_codegen.c                   |  2 +-
 src/panfrost/vulkan/panvk_vX_shader.c              |  2 +-
 19 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 5b7adb841c3..d987307cc9b 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -202,9 +202,9 @@ radv_optimize_nir(struct nir_shader *shader, bool 
optimize_conservatively)
       NIR_LOOP_PASS(progress, skip, shader, nir_copy_prop);
       NIR_LOOP_PASS(progress, skip, shader, nir_opt_remove_phis);
       NIR_LOOP_PASS(progress, skip, shader, nir_opt_dce);
-      bool trivial_continues_progress = false;
-      NIR_LOOP_PASS(trivial_continues_progress, skip, shader, 
nir_opt_trivial_continues);
-      if (trivial_continues_progress) {
+      bool opt_loop_progress = false;
+      NIR_LOOP_PASS(opt_loop_progress, skip, shader, nir_opt_loop);
+      if (opt_loop_progress) {
          progress = true;
          NIR_LOOP_PASS(progress, skip, shader, nir_copy_prop);
          NIR_LOOP_PASS(progress, skip, shader, nir_opt_remove_phis);
diff --git a/src/broadcom/compiler/nir_to_vir.c 
b/src/broadcom/compiler/nir_to_vir.c
index 1346e566c4e..4fdcaac73c2 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -2095,7 +2095,7 @@ v3d_optimize_nir(struct v3d_compile *c, struct nir_shader 
*s)
                 NIR_PASS(progress, s, nir_opt_idiv_const, 32);
                 NIR_PASS(progress, s, nir_lower_alu);
 
-                if (nir_opt_trivial_continues(s)) {
+                if (nir_opt_loop(s)) {
                    progress = true;
                    NIR_PASS(progress, s, nir_copy_prop);
                    NIR_PASS(progress, s, nir_opt_dce);
diff --git a/src/compiler/glsl/gl_nir_linker.c 
b/src/compiler/glsl/gl_nir_linker.c
index 0b38d26de06..0c1344b683d 100644
--- a/src/compiler/glsl/gl_nir_linker.c
+++ b/src/compiler/glsl/gl_nir_linker.c
@@ -76,7 +76,7 @@ gl_nir_opts(nir_shader *nir)
       NIR_PASS(progress, nir, nir_copy_prop);
       NIR_PASS(progress, nir, nir_opt_remove_phis);
       NIR_PASS(progress, nir, nir_opt_dce);
-      if (nir_opt_trivial_continues(nir)) {
+      if (nir_opt_loop(nir)) {
          progress = true;
          NIR_PASS(progress, nir, nir_copy_prop);
          NIR_PASS(progress, nir, nir_opt_dce);
diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c
index 2cdce66d998..e3596c54b9b 100644
--- a/src/freedreno/ir3/ir3_nir.c
+++ b/src/freedreno/ir3/ir3_nir.c
@@ -177,9 +177,9 @@ ir3_optimize_loop(struct ir3_compiler *compiler, nir_shader 
*s)
       }
 
       progress |= OPT(s, nir_opt_dead_cf);
-      if (OPT(s, nir_opt_trivial_continues)) {
+      if (OPT(s, nir_opt_loop)) {
          progress |= true;
-         /* If nir_opt_trivial_continues makes progress, then we need to clean
+         /* If nir_opt_loop makes progress, then we need to clean
           * things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
           * to make progress.
           */
diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c 
b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index 4cf7fbc20c4..34c370edff7 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -3344,7 +3344,7 @@ ntt_optimize_nir(struct nir_shader *s, struct pipe_screen 
*screen,
       NIR_PASS(progress, s, nir_opt_load_store_vectorize, &vectorize_opts);
       NIR_PASS(progress, s, nir_opt_shrink_stores, true);
       NIR_PASS(progress, s, nir_opt_shrink_vectors);
-      NIR_PASS(progress, s, nir_opt_trivial_continues);
+      NIR_PASS(progress, s, nir_opt_loop);
       NIR_PASS(progress, s, nir_opt_vectorize, ntt_should_vectorize_instr, 
NULL);
       NIR_PASS(progress, s, nir_opt_undef);
       NIR_PASS(progress, s, nir_opt_loop_unroll);
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c 
b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index bc53d47069b..d5a6c9b4494 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -2380,7 +2380,7 @@ ttn_optimize_nir(nir_shader *nir)
       NIR_PASS(progress, nir, nir_copy_prop);
       NIR_PASS(progress, nir, nir_opt_remove_phis);
       NIR_PASS(progress, nir, nir_opt_dce);
-      if (nir_opt_trivial_continues(nir)) {
+      if (nir_opt_loop(nir)) {
          progress = true;
          NIR_PASS(progress, nir, nir_copy_prop);
          NIR_PASS(progress, nir, nir_opt_dce);
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c 
b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
index 9c821625fe6..4d663395e75 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
@@ -157,9 +157,9 @@ etna_optimize_loop(nir_shader *s)
       progress |= OPT(s, nir_opt_algebraic);
       progress |= OPT(s, nir_opt_constant_folding);
       progress |= OPT(s, nir_opt_dead_cf);
-      if (OPT(s, nir_opt_trivial_continues)) {
+      if (OPT(s, nir_opt_loop)) {
          progress = true;
-         /* If nir_opt_trivial_continues makes progress, then we need to clean
+         /* If nir_opt_loop makes progress, then we need to clean
           * things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
           * to make progress.
           */
diff --git a/src/gallium/drivers/freedreno/a2xx/ir2_nir.c 
b/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
index bf7f717e20a..68cca059504 100644
--- a/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
+++ b/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
@@ -87,9 +87,9 @@ ir2_optimize_loop(nir_shader *s)
       progress |= OPT(s, nir_opt_algebraic);
       progress |= OPT(s, nir_opt_constant_folding);
       progress |= OPT(s, nir_opt_dead_cf);
-      if (OPT(s, nir_opt_trivial_continues)) {
+      if (OPT(s, nir_opt_loop)) {
          progress |= true;
-         /* If nir_opt_trivial_continues makes progress, then we need to clean
+         /* If nir_opt_loop makes progress, then we need to clean
           * things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
           * to make progress.
           */
diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c
index 10b21c323dc..cfd94261370 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -214,7 +214,7 @@ i915_optimize_nir(struct nir_shader *s)
       NIR_PASS(progress, s, nir_opt_constant_folding);
       NIR_PASS(progress, s, nir_opt_shrink_stores, true);
       NIR_PASS(progress, s, nir_opt_shrink_vectors);
-      NIR_PASS(progress, s, nir_opt_trivial_continues);
+      NIR_PASS(progress, s, nir_opt_loop);
       NIR_PASS(progress, s, nir_opt_undef);
       NIR_PASS(progress, s, nir_opt_loop_unroll);
 
diff --git a/src/gallium/drivers/r300/compiler/r300_nir.c 
b/src/gallium/drivers/r300/compiler/r300_nir.c
index 05f7b8c59e7..d82fc7c2865 100644
--- a/src/gallium/drivers/r300/compiler/r300_nir.c
+++ b/src/gallium/drivers/r300/compiler/r300_nir.c
@@ -97,7 +97,7 @@ r300_optimize_nir(struct nir_shader *s, struct pipe_screen 
*screen)
       NIR_PASS(progress, s, nir_opt_load_store_vectorize, &vectorize_opts);
       NIR_PASS(progress, s, nir_opt_shrink_stores, true);
       NIR_PASS(progress, s, nir_opt_shrink_vectors);
-      NIR_PASS(progress, s, nir_opt_trivial_continues);
+      NIR_PASS(progress, s, nir_opt_loop);
       NIR_PASS(progress, s, nir_opt_vectorize, r300_should_vectorize_instr, 
NULL);
       NIR_PASS(progress, s, nir_opt_undef);
       if(!progress)
diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.cpp 
b/src/gallium/drivers/r600/sfn/sfn_nir.cpp
index b973cdfa221..70f10c83deb 100644
--- a/src/gallium/drivers/r600/sfn/sfn_nir.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_nir.cpp
@@ -647,7 +647,7 @@ optimize_once(nir_shader *shader)
    NIR_PASS(progress, shader, nir_opt_copy_prop_vars);
    NIR_PASS(progress, shader, nir_opt_remove_phis);
 
-   if (nir_opt_trivial_continues(shader)) {
+   if (nir_opt_loop(shader)) {
       progress = true;
       NIR_PASS(progress, shader, nir_copy_prop);
       NIR_PASS(progress, shader, nir_opt_dce);
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c 
b/src/gallium/drivers/radeonsi/si_shader_nir.c
index ffc1dcf4469..d17de169459 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -91,7 +91,7 @@ void si_nir_opts(struct si_screen *sscreen, struct nir_shader 
*nir, bool first)
       NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
       NIR_PASS(progress, nir, nir_opt_dead_write_vars);
 
-      NIR_PASS(lower_alu_to_scalar, nir, nir_opt_trivial_continues);
+      NIR_PASS(lower_alu_to_scalar, nir, nir_opt_loop);
       /* (Constant) copy propagation is needed for txf with offsets. */
       NIR_PASS(progress, nir, nir_copy_prop);
       NIR_PASS(progress, nir, nir_opt_remove_phis);
diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c 
b/src/gallium/frontends/lavapipe/lvp_pipeline.c
index d8ac16aa9a4..e5dcb9c4275 100644
--- a/src/gallium/frontends/lavapipe/lvp_pipeline.c
+++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c
@@ -235,11 +235,11 @@ optimize(nir_shader *nir)
       NIR_PASS(progress, nir, nir_opt_constant_folding);
 
       NIR_PASS(progress, nir, nir_opt_remove_phis);
-      bool trivial_continues = false;
-      NIR_PASS(trivial_continues, nir, nir_opt_trivial_continues);
-      progress |= trivial_continues;
-      if (trivial_continues) {
-         /* If nir_opt_trivial_continues makes progress, then we need to clean
+      bool loop = false;
+      NIR_PASS(loop, nir, nir_opt_loop);
+      progress |= loop;
+      if (loop) {
+         /* If nir_opt_loop makes progress, then we need to clean
           * things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
           * to make progress.
           */
diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
index e0043fffebf..ceb599d20e5 100644
--- a/src/intel/compiler/brw_nir.c
+++ b/src/intel/compiler/brw_nir.c
@@ -709,8 +709,8 @@ brw_nir_optimize(nir_shader *nir, bool is_scalar,
       }
 
       OPT(nir_opt_dead_cf);
-      if (OPT(nir_opt_trivial_continues)) {
-         /* If nir_opt_trivial_continues makes progress, then we need to clean
+      if (OPT(nir_opt_loop)) {
+         /* If nir_opt_loop makes progress, then we need to clean
           * things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
           * to make progress.
           */
diff --git a/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c 
b/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c
index 353a9aee729..c70badff2f6 100644
--- a/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c
+++ b/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c
@@ -1114,7 +1114,7 @@ dxil_spirv_nir_passes(nir_shader *nir,
          NIR_PASS(progress, nir, nir_opt_undef);
          NIR_PASS(progress, nir, nir_opt_constant_folding);
          NIR_PASS(progress, nir, nir_opt_cse);
-         if (nir_opt_trivial_continues(nir)) {
+         if (nir_opt_loop(nir)) {
             progress = true;
             NIR_PASS(progress, nir, nir_copy_prop);
             NIR_PASS(progress, nir, nir_opt_dce);
diff --git a/src/nouveau/codegen/nv50_ir_from_nir.cpp 
b/src/nouveau/codegen/nv50_ir_from_nir.cpp
index 7543b4446b7..a89342d7379 100644
--- a/src/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -3304,7 +3304,7 @@ Converter::run()
       progress = false;
       NIR_PASS(progress, nir, nir_copy_prop);
       NIR_PASS(progress, nir, nir_opt_remove_phis);
-      NIR_PASS(progress, nir, nir_opt_trivial_continues);
+      NIR_PASS(progress, nir, nir_opt_loop);
       NIR_PASS(progress, nir, nir_opt_cse);
       NIR_PASS(progress, nir, nir_opt_algebraic);
       NIR_PASS(progress, nir, nir_opt_constant_folding);
diff --git a/src/nouveau/compiler/nak_nir.c b/src/nouveau/compiler/nak_nir.c
index c878c8b1d16..22df7a5a774 100644
--- a/src/nouveau/compiler/nak_nir.c
+++ b/src/nouveau/compiler/nak_nir.c
@@ -116,10 +116,10 @@ optimize_nir(nir_shader *nir, const struct nak_compiler 
*nak, bool allow_copies)
       }
 
       OPT(nir, nir_opt_dead_cf);
-      if (OPT(nir, nir_opt_trivial_continues)) {
-         /* If nir_opt_trivial_continues makes progress, then we need to clean
-          * things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
-          * to make progress.
+      if (OPT(nir, nir_opt_loop)) {
+         /* If nir_opt_loop makes progress, then we need to clean things up
+          * if we want any hope of nir_opt_if or nir_opt_loop_unroll to make
+          * progress.
           */
          OPT(nir, nir_copy_prop);
          OPT(nir, nir_opt_dce);
diff --git a/src/nouveau/vulkan/nvk_codegen.c b/src/nouveau/vulkan/nvk_codegen.c
index 725361f6a26..644a19428e0 100644
--- a/src/nouveau/vulkan/nvk_codegen.c
+++ b/src/nouveau/vulkan/nvk_codegen.c
@@ -149,7 +149,7 @@ nvk_cg_optimize_nir(nir_shader *nir)
       NIR_PASS(progress, nir, nir_copy_prop);
       NIR_PASS(progress, nir, nir_opt_remove_phis);
       NIR_PASS(progress, nir, nir_opt_dce);
-      if (nir_opt_trivial_continues(nir)) {
+      if (nir_opt_loop(nir)) {
          progress = true;
          NIR_PASS(progress, nir, nir_copy_prop);
          NIR_PASS(progress, nir, nir_opt_remove_phis);
diff --git a/src/panfrost/vulkan/panvk_vX_shader.c 
b/src/panfrost/vulkan/panvk_vX_shader.c
index 3e3f9e8f9bc..431eec3aa59 100644
--- a/src/panfrost/vulkan/panvk_vX_shader.c
+++ b/src/panfrost/vulkan/panvk_vX_shader.c
@@ -264,7 +264,7 @@ panvk_per_arch(shader_create)(struct panvk_device *dev, 
gl_shader_stage stage,
 
    NIR_PASS_V(nir, nir_opt_copy_prop_vars);
    NIR_PASS_V(nir, nir_opt_combine_stores, nir_var_all);
-   NIR_PASS_V(nir, nir_opt_trivial_continues);
+   NIR_PASS_V(nir, nir_opt_loop);
 
    /* Do texture lowering here.  Yes, it's a duplication of the texture
     * lowering in bifrost_compile.  However, we need to lower texture stuff

Reply via email to