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

Author: Daniel Schürmann <[email protected]>
Date:   Thu Dec  2 10:31:56 2021 +0100

nir: add assertions that loops don't have a Continue Construct

Hoping that I didn't miss any, this *should* add assertions
to all functions and passes which explicitly handle 'nir_loop'.

Acked-by: Faith Ekstrand <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13962>

---

 src/amd/compiler/aco_instruction_selection.cpp       | 1 +
 src/amd/compiler/aco_instruction_selection_setup.cpp | 1 +
 src/amd/llvm/ac_nir_to_llvm.c                        | 1 +
 src/asahi/compiler/agx_compile.c                     | 1 +
 src/broadcom/compiler/nir_to_vir.c                   | 2 ++
 src/compiler/nir/nir_divergence_analysis.c           | 1 +
 src/compiler/nir/nir_inline_uniforms.c               | 1 +
 src/compiler/nir/nir_loop_analyze.c                  | 2 ++
 src/compiler/nir/nir_lower_memory_model.c            | 2 ++
 src/compiler/nir/nir_lower_returns.c                 | 1 +
 src/compiler/nir/nir_lower_shader_calls.c            | 2 ++
 src/compiler/nir/nir_opt_copy_prop_vars.c            | 2 ++
 src/compiler/nir/nir_opt_dce.c                       | 1 +
 src/compiler/nir/nir_opt_dead_cf.c                   | 1 +
 src/compiler/nir/nir_opt_gcm.c                       | 3 +++
 src/compiler/nir/nir_opt_if.c                        | 3 +++
 src/compiler/nir/nir_opt_loop_unroll.c               | 1 +
 src/compiler/nir/nir_opt_sink.c                      | 1 +
 src/compiler/nir/nir_opt_trivial_continues.c         | 1 +
 src/compiler/nir/nir_sweep.c                         | 1 +
 src/compiler/nir/nir_to_lcssa.c                      | 2 ++
 src/freedreno/ir3/ir3_compiler_nir.c                 | 1 +
 src/gallium/auxiliary/gallivm/lp_bld_nir.c           | 1 +
 src/gallium/auxiliary/nir/nir_to_tgsi.c              | 1 +
 src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c   | 1 +
 src/gallium/drivers/freedreno/a2xx/ir2_nir.c         | 1 +
 src/gallium/drivers/lima/ir/pp/nir.c                 | 1 +
 src/gallium/drivers/r600/sfn/sfn_shader.cpp          | 1 +
 src/gallium/drivers/radeonsi/si_shader_info.c        | 1 +
 src/gallium/drivers/vc4/vc4_program.c                | 1 +
 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 1 +
 src/intel/compiler/brw_fs_nir.cpp                    | 1 +
 src/intel/compiler/brw_vec4_nir.cpp                  | 1 +
 src/microsoft/compiler/nir_to_dxil.c                 | 1 +
 src/nouveau/codegen/nv50_ir_from_nir.cpp             | 1 +
 src/panfrost/compiler/bifrost_compile.c              | 2 ++
 src/panfrost/midgard/midgard_compile.c               | 2 ++
 37 files changed, 49 insertions(+)

diff --git a/src/amd/compiler/aco_instruction_selection.cpp 
b/src/amd/compiler/aco_instruction_selection.cpp
index 9ea40736d17..5b4e0931edc 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -10340,6 +10340,7 @@ static void end_uniform_if(isel_context* ctx, 
if_context* ic);
 static void
 visit_loop(isel_context* ctx, nir_loop* loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    loop_context lc;
    begin_loop(ctx, &lc);
 
diff --git a/src/amd/compiler/aco_instruction_selection_setup.cpp 
b/src/amd/compiler/aco_instruction_selection_setup.cpp
index d43c5966ed5..df4e0bd7c58 100644
--- a/src/amd/compiler/aco_instruction_selection_setup.cpp
+++ b/src/amd/compiler/aco_instruction_selection_setup.cpp
@@ -167,6 +167,7 @@ sanitize_cf_list(nir_function_impl* impl, struct exec_list* 
cf_list)
       }
       case nir_cf_node_loop: {
          nir_loop* loop = nir_cf_node_as_loop(cf_node);
+         assert(!nir_loop_has_continue_construct(loop));
          progress |= sanitize_cf_list(impl, &loop->body);
          break;
       }
diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index 30e5dc4c6aa..63af9f5e77d 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -4988,6 +4988,7 @@ static bool visit_if(struct ac_nir_context *ctx, nir_if 
*if_stmt)
 
 static bool visit_loop(struct ac_nir_context *ctx, nir_loop *loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    nir_block *first_loop_block = (nir_block *)exec_list_get_head(&loop->body);
 
    ac_build_bgnloop(&ctx->ac, first_loop_block->index);
diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c
index 277fe5fad96..67a77a9378f 100644
--- a/src/asahi/compiler/agx_compile.c
+++ b/src/asahi/compiler/agx_compile.c
@@ -1668,6 +1668,7 @@ emit_if(agx_context *ctx, nir_if *nif)
 static void
 emit_loop(agx_context *ctx, nir_loop *nloop)
 {
+   assert(!nir_loop_has_continue_construct(nloop));
    /* We only track nesting within the innermost loop, so push and reset */
    unsigned pushed_nesting = ctx->loop_nesting;
    ctx->loop_nesting = 0;
diff --git a/src/broadcom/compiler/nir_to_vir.c 
b/src/broadcom/compiler/nir_to_vir.c
index 6a387aaf560..1b9b56805fa 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -4246,6 +4246,8 @@ ntq_emit_uniform_loop(struct v3d_compile *c, nir_loop 
*loop)
 static void
 ntq_emit_loop(struct v3d_compile *c, nir_loop *loop)
 {
+        assert(!nir_loop_has_continue_construct(loop));
+
         /* Disable flags optimization for loop conditions. The problem here is
          * that we can have code like this:
          *
diff --git a/src/compiler/nir/nir_divergence_analysis.c 
b/src/compiler/nir/nir_divergence_analysis.c
index 6b359e61b66..cfb91c6212f 100644
--- a/src/compiler/nir/nir_divergence_analysis.c
+++ b/src/compiler/nir/nir_divergence_analysis.c
@@ -1049,6 +1049,7 @@ visit_if(nir_if *if_stmt, struct divergence_state *state)
 static bool
 visit_loop(nir_loop *loop, struct divergence_state *state)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    bool progress = false;
    nir_block *loop_header = nir_loop_first_block(loop);
    nir_block *loop_preheader = nir_block_cf_tree_prev(loop_header);
diff --git a/src/compiler/nir/nir_inline_uniforms.c 
b/src/compiler/nir/nir_inline_uniforms.c
index 5589a6f9485..9194c200486 100644
--- a/src/compiler/nir/nir_inline_uniforms.c
+++ b/src/compiler/nir/nir_inline_uniforms.c
@@ -319,6 +319,7 @@ process_node(nir_cf_node *node, nir_loop_info *info,
 
    case nir_cf_node_loop: {
       nir_loop *loop = nir_cf_node_as_loop(node);
+      assert(!nir_loop_has_continue_construct(loop));
 
       /* Replace loop info, no nested loop info currently:
        *
diff --git a/src/compiler/nir/nir_loop_analyze.c 
b/src/compiler/nir/nir_loop_analyze.c
index 6c923ae6f52..a9be89ca18b 100644
--- a/src/compiler/nir/nir_loop_analyze.c
+++ b/src/compiler/nir/nir_loop_analyze.c
@@ -1415,6 +1415,8 @@ process_loops(nir_cf_node *cf_node, nir_variable_mode 
indirect_mask,
    }
    case nir_cf_node_loop: {
       nir_loop *loop = nir_cf_node_as_loop(cf_node);
+      assert(!nir_loop_has_continue_construct(loop));
+
       foreach_list_typed(nir_cf_node, nested_node, node, &loop->body)
          process_loops(nested_node, indirect_mask, 
force_unroll_sampler_indirect);
       break;
diff --git a/src/compiler/nir/nir_lower_memory_model.c 
b/src/compiler/nir/nir_lower_memory_model.c
index 8180f5ef041..b466cee6f58 100644
--- a/src/compiler/nir/nir_lower_memory_model.c
+++ b/src/compiler/nir/nir_lower_memory_model.c
@@ -215,6 +215,7 @@ lower_make_visible(nir_cf_node *cf_node, uint32_t 
*cur_modes)
    }
    case nir_cf_node_loop: {
       nir_loop *loop = nir_cf_node_as_loop(cf_node);
+      assert(!nir_loop_has_continue_construct(loop));
       bool loop_progress;
       do {
          loop_progress = false;
@@ -254,6 +255,7 @@ lower_make_available(nir_cf_node *cf_node, uint32_t 
*cur_modes)
    }
    case nir_cf_node_loop: {
       nir_loop *loop = nir_cf_node_as_loop(cf_node);
+      assert(!nir_loop_has_continue_construct(loop));
       bool loop_progress;
       do {
          loop_progress = false;
diff --git a/src/compiler/nir/nir_lower_returns.c 
b/src/compiler/nir/nir_lower_returns.c
index 0b3fb2f039e..d7126cbe042 100644
--- a/src/compiler/nir/nir_lower_returns.c
+++ b/src/compiler/nir/nir_lower_returns.c
@@ -82,6 +82,7 @@ predicate_following(nir_cf_node *node, struct 
lower_returns_state *state)
 static bool
 lower_returns_in_loop(nir_loop *loop, struct lower_returns_state *state)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    nir_loop *parent = state->loop;
    state->loop = loop;
    bool progress = lower_returns_in_cf_list(&loop->body, state);
diff --git a/src/compiler/nir/nir_lower_shader_calls.c 
b/src/compiler/nir/nir_lower_shader_calls.c
index 02c8478c46b..03a924f00e5 100644
--- a/src/compiler/nir/nir_lower_shader_calls.c
+++ b/src/compiler/nir/nir_lower_shader_calls.c
@@ -790,6 +790,7 @@ duplicate_loop_bodies(nir_function_impl *impl, nir_instr 
*resume_instr)
          continue;
 
       nir_loop *loop = nir_cf_node_as_loop(node);
+      assert(!nir_loop_has_continue_construct(loop));
 
       if (resume_reg == NULL) {
          /* We only create resume_reg if we encounter a loop.  This way we can
@@ -1038,6 +1039,7 @@ flatten_resume_if_ladder(nir_builder *b,
       case nir_cf_node_loop: {
          assert(!before_cursor);
          nir_loop *loop = nir_cf_node_as_loop(child);
+         assert(!nir_loop_has_continue_construct(loop));
 
          if (cf_node_contains_block(&loop->cf_node, resume_instr->block)) {
             /* Thanks to our loop body duplication pass, every level of loop
diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c 
b/src/compiler/nir/nir_opt_copy_prop_vars.c
index d9d1f66e694..8cc99d5e6d0 100644
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c
@@ -295,6 +295,7 @@ gather_vars_written(struct copy_prop_var_state *state,
 
    case nir_cf_node_loop: {
       nir_loop *loop = nir_cf_node_as_loop(cf_node);
+      assert(!nir_loop_has_continue_construct(loop));
 
       new_written = create_vars_written(state);
 
@@ -1472,6 +1473,7 @@ copy_prop_vars_cf_node(struct copy_prop_var_state *state,
 
    case nir_cf_node_loop: {
       nir_loop *loop = nir_cf_node_as_loop(cf_node);
+      assert(!nir_loop_has_continue_construct(loop));
 
       /* Invalidate before cloning the copies for the loop, since the loop
        * body can be executed more than once.
diff --git a/src/compiler/nir/nir_opt_dce.c b/src/compiler/nir/nir_opt_dce.c
index 1f4b0b33fb4..3f1f62fd499 100644
--- a/src/compiler/nir/nir_opt_dce.c
+++ b/src/compiler/nir/nir_opt_dce.c
@@ -167,6 +167,7 @@ dce_cf_list(struct exec_list *cf_list, BITSET_WORD 
*defs_live,
       }
       case nir_cf_node_loop: {
          nir_loop *loop = nir_cf_node_as_loop(cf_node);
+         assert(!nir_loop_has_continue_construct(loop));
 
          struct loop_state inner_state;
          inner_state.preheader = 
nir_cf_node_as_block(nir_cf_node_prev(cf_node));
diff --git a/src/compiler/nir/nir_opt_dead_cf.c 
b/src/compiler/nir/nir_opt_dead_cf.c
index d93d192ad4f..5354a7f9228 100644
--- a/src/compiler/nir/nir_opt_dead_cf.c
+++ b/src/compiler/nir/nir_opt_dead_cf.c
@@ -373,6 +373,7 @@ dead_cf_list(struct exec_list *list, bool 
*list_ends_in_jump)
 
       case nir_cf_node_loop: {
          nir_loop *loop = nir_cf_node_as_loop(cur);
+         assert(!nir_loop_has_continue_construct(loop));
          bool dummy;
          progress |= dead_cf_list(&loop->body, &dummy);
 
diff --git a/src/compiler/nir/nir_opt_gcm.c b/src/compiler/nir/nir_opt_gcm.c
index 2770fdce732..1b58b88116c 100644
--- a/src/compiler/nir/nir_opt_gcm.c
+++ b/src/compiler/nir/nir_opt_gcm.c
@@ -117,6 +117,7 @@ get_loop_instr_count(struct exec_list *cf_list)
       }
       case nir_cf_node_loop: {
          nir_loop *loop = nir_cf_node_as_loop(node);
+         assert(!nir_loop_has_continue_construct(loop));
          loop_instr_count += get_loop_instr_count(&loop->body);
          break;
       }
@@ -154,6 +155,7 @@ gcm_build_block_info(struct exec_list *cf_list, struct 
gcm_state *state,
       }
       case nir_cf_node_loop: {
          nir_loop *loop = nir_cf_node_as_loop(node);
+         assert(!nir_loop_has_continue_construct(loop));
          gcm_build_block_info(&loop->body, state, loop, loop_depth + 1, 
if_depth,
                               get_loop_instr_count(&loop->body));
          break;
@@ -503,6 +505,7 @@ set_block_for_loop_instr(struct gcm_state *state, nir_instr 
*instr,
    if (loop == NULL)
       return true;
 
+   assert(!nir_loop_has_continue_construct(loop));
    if (nir_block_dominates(instr->block, block))
       return true;
 
diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c
index 142e0ef3d95..3711c15959e 100644
--- a/src/compiler/nir/nir_opt_if.c
+++ b/src/compiler/nir/nir_opt_if.c
@@ -1621,6 +1621,7 @@ opt_if_cf_list(nir_builder *b, struct exec_list *cf_list,
 
       case nir_cf_node_loop: {
          nir_loop *loop = nir_cf_node_as_loop(cf_node);
+         assert(!nir_loop_has_continue_construct(loop));
          progress |= opt_if_cf_list(b, &loop->body,
                                     options);
          progress |= opt_simplify_bcsel_of_phi(b, loop);
@@ -1666,6 +1667,7 @@ opt_if_regs_cf_list(struct exec_list *cf_list)
 
       case nir_cf_node_loop: {
          nir_loop *loop = nir_cf_node_as_loop(cf_node);
+         assert(!nir_loop_has_continue_construct(loop));
          progress |= opt_if_regs_cf_list(&loop->body);
          progress |= opt_peel_loop_initial_if(loop);
          break;
@@ -1704,6 +1706,7 @@ opt_if_safe_cf_list(nir_builder *b, struct exec_list 
*cf_list)
 
       case nir_cf_node_loop: {
          nir_loop *loop = nir_cf_node_as_loop(cf_node);
+         assert(!nir_loop_has_continue_construct(loop));
          progress |= opt_if_safe_cf_list(b, &loop->body);
          progress |= opt_split_alu_of_phi(b, loop);
          break;
diff --git a/src/compiler/nir/nir_opt_loop_unroll.c 
b/src/compiler/nir/nir_opt_loop_unroll.c
index 43f9816a07c..2a6618488ad 100644
--- a/src/compiler/nir/nir_opt_loop_unroll.c
+++ b/src/compiler/nir/nir_opt_loop_unroll.c
@@ -969,6 +969,7 @@ process_loops(nir_shader *sh, nir_cf_node *cf_node, bool 
*has_nested_loop_out,
    }
    case nir_cf_node_loop: {
       loop = nir_cf_node_as_loop(cf_node);
+      assert(!nir_loop_has_continue_construct(loop));
       progress |= process_loops_in_block(sh, &loop->body, &has_nested_loop);
 
       break;
diff --git a/src/compiler/nir/nir_opt_sink.c b/src/compiler/nir/nir_opt_sink.c
index 73607655fa9..a1423f7b274 100644
--- a/src/compiler/nir/nir_opt_sink.c
+++ b/src/compiler/nir/nir_opt_sink.c
@@ -88,6 +88,7 @@ get_innermost_loop(nir_cf_node *node)
 static bool
 loop_contains_block(nir_loop *loop, nir_block *block)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    nir_block *before = nir_cf_node_as_block(nir_cf_node_prev(&loop->cf_node));
    nir_block *after = nir_cf_node_as_block(nir_cf_node_next(&loop->cf_node));
 
diff --git a/src/compiler/nir/nir_opt_trivial_continues.c 
b/src/compiler/nir/nir_opt_trivial_continues.c
index 496811965ac..a90f851e961 100644
--- a/src/compiler/nir/nir_opt_trivial_continues.c
+++ b/src/compiler/nir/nir_opt_trivial_continues.c
@@ -93,6 +93,7 @@ lower_trivial_continues_list(struct exec_list *cf_list,
 
       case nir_cf_node_loop: {
          nir_loop *loop = nir_cf_node_as_loop(cf_node);
+         assert(!nir_loop_has_continue_construct(loop));
          if (lower_trivial_continues_list(&loop->body, true, loop))
             progress = true;
          if (lower_trivial_continues_block(nir_loop_last_block(loop), loop))
diff --git a/src/compiler/nir/nir_sweep.c b/src/compiler/nir/nir_sweep.c
index ca3ec1dbf60..cdb75c6d588 100644
--- a/src/compiler/nir/nir_sweep.c
+++ b/src/compiler/nir/nir_sweep.c
@@ -109,6 +109,7 @@ sweep_if(nir_shader *nir, nir_if *iff)
 static void
 sweep_loop(nir_shader *nir, nir_loop *loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    ralloc_steal(nir, loop);
 
    foreach_list_typed(nir_cf_node, cf_node, node, &loop->body) {
diff --git a/src/compiler/nir/nir_to_lcssa.c b/src/compiler/nir/nir_to_lcssa.c
index 1a2c24d143e..9d043a43630 100644
--- a/src/compiler/nir/nir_to_lcssa.c
+++ b/src/compiler/nir/nir_to_lcssa.c
@@ -317,6 +317,7 @@ convert_to_lcssa(nir_cf_node *cf_node, lcssa_state *state)
 
       /* first, convert inner loops */
       nir_loop *loop = nir_cf_node_as_loop(cf_node);
+      assert(!nir_loop_has_continue_construct(loop));
       foreach_list_typed(nir_cf_node, nested_node, node, &loop->body)
          convert_to_lcssa(nested_node, state);
 
@@ -370,6 +371,7 @@ end:
 void
 nir_convert_loop_to_lcssa(nir_loop *loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    nir_function_impl *impl = nir_cf_node_get_function(&loop->cf_node);
 
    nir_metadata_require(impl, nir_metadata_block_index);
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c 
b/src/freedreno/ir3/ir3_compiler_nir.c
index 89a5d785fff..6484a37f08a 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -3676,6 +3676,7 @@ emit_if(struct ir3_context *ctx, nir_if *nif)
 static void
 emit_loop(struct ir3_context *ctx, nir_loop *nloop)
 {
+   assert(!nir_loop_has_continue_construct(nloop));
    unsigned old_loop_id = ctx->loop_id;
    ctx->loop_id = ctx->so->loops + 1;
    ctx->loop_depth++;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c 
b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
index 8602491728d..2ef3d4b655b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
@@ -2634,6 +2634,7 @@ visit_if(struct lp_build_nir_context *bld_base, nir_if 
*if_stmt)
 static void
 visit_loop(struct lp_build_nir_context *bld_base, nir_loop *loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    bld_base->bgnloop(bld_base);
    visit_cf_list(bld_base, &loop->body);
    bld_base->endloop(bld_base);
diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c 
b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index e2a43997487..9336289460c 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -2952,6 +2952,7 @@ ntt_emit_if(struct ntt_compile *c, nir_if *if_stmt)
 static void
 ntt_emit_loop(struct ntt_compile *c, nir_loop *loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    ntt_BGNLOOP(c);
    ntt_emit_cf_list(c, &loop->body);
    ntt_ENDLOOP(c);
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c 
b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
index b4ec5071795..8204f8335c6 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
@@ -680,6 +680,7 @@ emit_cf_list(struct etna_compile *c, struct exec_list *list)
          emit_if(c, nir_cf_node_as_if(node));
          break;
       case nir_cf_node_loop:
+         assert(!nir_loop_has_continue_construct(nir_cf_node_as_loop(node)));
          emit_cf_list(c, &nir_cf_node_as_loop(node)->body);
          break;
       default:
diff --git a/src/gallium/drivers/freedreno/a2xx/ir2_nir.c 
b/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
index 9aa23b8b976..a6ded4e8fc3 100644
--- a/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
+++ b/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
@@ -1019,6 +1019,7 @@ loop_last_block(struct exec_list *list)
 static void
 emit_loop(struct ir2_context *ctx, nir_loop *nloop)
 {
+   assert(!nir_loop_has_continue_construct(nloop));
    ctx->loop_last_block[++ctx->loop_depth] = loop_last_block(&nloop->body);
    emit_cf_list(ctx, &nloop->body);
    ctx->loop_depth--;
diff --git a/src/gallium/drivers/lima/ir/pp/nir.c 
b/src/gallium/drivers/lima/ir/pp/nir.c
index 7e1a5d3a8b9..070dfb80caf 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -733,6 +733,7 @@ static bool ppir_emit_if(ppir_compiler *comp, nir_if 
*if_stmt)
 
 static bool ppir_emit_loop(ppir_compiler *comp, nir_loop *nloop)
 {
+   assert(!nir_loop_has_continue_construct(nloop));
    ppir_block *save_loop_cont_block = comp->loop_cont_block;
    ppir_block *block;
    ppir_branch_node *loop_branch;
diff --git a/src/gallium/drivers/r600/sfn/sfn_shader.cpp 
b/src/gallium/drivers/r600/sfn/sfn_shader.cpp
index 8cccf3897ec..66f21194a36 100644
--- a/src/gallium/drivers/r600/sfn/sfn_shader.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_shader.cpp
@@ -774,6 +774,7 @@ Shader::emit_control_flow(ControlFlowInstr::CFType type)
 bool
 Shader::process_loop(nir_loop *node)
 {
+   assert(!nir_loop_has_continue_construct(node));
    SFN_TRACE_FUNC(SfnLog::flow, "LOOP");
    if (!emit_control_flow(ControlFlowInstr::cf_loop_begin))
       return false;
diff --git a/src/gallium/drivers/radeonsi/si_shader_info.c 
b/src/gallium/drivers/radeonsi/si_shader_info.c
index 68dc0f8205d..ddfbe856e79 100644
--- a/src/gallium/drivers/radeonsi/si_shader_info.c
+++ b/src/gallium/drivers/radeonsi/si_shader_info.c
@@ -157,6 +157,7 @@ static void scan_tess_ctrl(nir_cf_node *cf_node, unsigned 
*upper_block_tf_writem
    }
    case nir_cf_node_loop: {
       nir_loop *loop = nir_cf_node_as_loop(cf_node);
+      assert(!nir_loop_has_continue_construct(loop));
       foreach_list_typed(nir_cf_node, nested_node, node, &loop->body)
       {
          scan_tess_ctrl(nested_node, cond_block_tf_writemask, 
cond_block_tf_writemask,
diff --git a/src/gallium/drivers/vc4/vc4_program.c 
b/src/gallium/drivers/vc4/vc4_program.c
index 52c4c86a847..0f2e92a8746 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -2050,6 +2050,7 @@ static void ntq_emit_cf_list(struct vc4_compile *c, 
struct exec_list *list);
 static void
 ntq_emit_loop(struct vc4_compile *c, nir_loop *loop)
 {
+        assert(!nir_loop_has_continue_construct(loop));
         if (!c->vc4->screen->has_control_flow) {
                 fprintf(stderr,
                         "loop support requires updated kernel.\n");
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c 
b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 577ccf2d19f..060dadc1bbb 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -4170,6 +4170,7 @@ emit_if(struct ntv_context *ctx, nir_if *if_stmt)
 static void
 emit_loop(struct ntv_context *ctx, nir_loop *loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    SpvId header_id = spirv_builder_new_id(&ctx->builder);
    SpvId begin_id = block_label(ctx, nir_loop_first_block(loop));
    SpvId break_id = spirv_builder_new_id(&ctx->builder);
diff --git a/src/intel/compiler/brw_fs_nir.cpp 
b/src/intel/compiler/brw_fs_nir.cpp
index 7e0cfb3c71e..b41bd4ee715 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -388,6 +388,7 @@ fs_visitor::nir_emit_if(nir_if *if_stmt)
 void
 fs_visitor::nir_emit_loop(nir_loop *loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    bld.emit(BRW_OPCODE_DO);
 
    nir_emit_cf_list(&loop->body);
diff --git a/src/intel/compiler/brw_vec4_nir.cpp 
b/src/intel/compiler/brw_vec4_nir.cpp
index 197306be3e8..8a3ae91b904 100644
--- a/src/intel/compiler/brw_vec4_nir.cpp
+++ b/src/intel/compiler/brw_vec4_nir.cpp
@@ -124,6 +124,7 @@ vec4_visitor::nir_emit_if(nir_if *if_stmt)
 void
 vec4_visitor::nir_emit_loop(nir_loop *loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    emit(BRW_OPCODE_DO);
 
    nir_emit_cf_list(&loop->body);
diff --git a/src/microsoft/compiler/nir_to_dxil.c 
b/src/microsoft/compiler/nir_to_dxil.c
index a066f66e02a..f87b944a28f 100644
--- a/src/microsoft/compiler/nir_to_dxil.c
+++ b/src/microsoft/compiler/nir_to_dxil.c
@@ -5646,6 +5646,7 @@ emit_if(struct ntd_context *ctx, struct nir_if *if_stmt)
 static bool
 emit_loop(struct ntd_context *ctx, nir_loop *loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    nir_block *first_block = nir_loop_first_block(loop);
    nir_block *last_block = nir_loop_last_block(loop);
 
diff --git a/src/nouveau/codegen/nv50_ir_from_nir.cpp 
b/src/nouveau/codegen/nv50_ir_from_nir.cpp
index 6970dcd63bb..cb0c0e2aa43 100644
--- a/src/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -1556,6 +1556,7 @@ Converter::visit(nir_if *nif)
 bool
 Converter::visit(nir_loop *loop)
 {
+   assert(!nir_loop_has_continue_construct(loop));
    curLoopDepth += 1;
    func->loopNestingBound = std::max(func->loopNestingBound, curLoopDepth);
 
diff --git a/src/panfrost/compiler/bifrost_compile.c 
b/src/panfrost/compiler/bifrost_compile.c
index 801803e9895..cd2eb54a58e 100644
--- a/src/panfrost/compiler/bifrost_compile.c
+++ b/src/panfrost/compiler/bifrost_compile.c
@@ -4070,6 +4070,8 @@ emit_if(bi_context *ctx, nir_if *nif)
 static void
 emit_loop(bi_context *ctx, nir_loop *nloop)
 {
+   assert(!nir_loop_has_continue_construct(nloop));
+
    /* Remember where we are */
    bi_block *start_block = ctx->current_block;
 
diff --git a/src/panfrost/midgard/midgard_compile.c 
b/src/panfrost/midgard/midgard_compile.c
index 780166df5b1..a56ade24124 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -2935,6 +2935,8 @@ emit_if(struct compiler_context *ctx, nir_if *nif)
 static void
 emit_loop(struct compiler_context *ctx, nir_loop *nloop)
 {
+   assert(!nir_loop_has_continue_construct(nloop));
+
    /* Remember where we are */
    midgard_block *start_block = ctx->current_block;
 

Reply via email to