aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2020-04-30 17:30:02 -0700
committerMarge Bot <[email protected]>2020-05-01 16:26:31 +0000
commitb0b8011e3eab048a8a8c1a2f79ae003cddb62284 (patch)
tree0c79ada55474cc282cef83fe844937502df6c843 /src
parent7bd15135a6dc105939a3e1c349217e6346dcf729 (diff)
freedreno/ir3: Set up the block predecessors for a3xx TF
Fixes a segfault in ir3_legalize. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4562>
Diffstat (limited to 'src')
-rw-r--r--src/freedreno/ir3/ir3.c1
-rw-r--r--src/freedreno/ir3/ir3_compiler_nir.c9
2 files changed, 8 insertions, 2 deletions
diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c
index d4fcd995ed0..cb7418bf2e0 100644
--- a/src/freedreno/ir3/ir3.c
+++ b/src/freedreno/ir3/ir3.c
@@ -1023,6 +1023,7 @@ struct ir3_block * ir3_block_create(struct ir3 *shader)
block->shader = shader;
list_inithead(&block->node);
list_inithead(&block->instr_list);
+ block->predecessors = _mesa_pointer_set_create(block);
return block;
}
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index 5f55596bb63..9c42efd67ad 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -2644,7 +2644,6 @@ get_block(struct ir3_context *ctx, const nir_block *nblock)
block->nblock = nblock;
_mesa_hash_table_insert(ctx->block_ht, nblock, block);
- block->predecessors = _mesa_pointer_set_create(block);
set_foreach(nblock->predecessors, sentry) {
_mesa_set_add(block->predecessors, get_block(ctx, sentry->key));
}
@@ -2758,10 +2757,12 @@ emit_cf_list(struct ir3_context *ctx, struct exec_list *list)
* // succs: blockStreamOut, blockNewEnd
* }
* blockStreamOut {
+ * // preds: blockOrigEnd
* ... stream-out instructions ...
* // succs: blockNewEnd
* }
* blockNewEnd {
+ * // preds: blockOrigEnd, blockStreamOut
* }
*/
static void
@@ -2787,7 +2788,6 @@ emit_stream_out(struct ir3_context *ctx)
*/
orig_end_block = ctx->block;
-// TODO these blocks need to update predecessors..
// maybe w/ store_global intrinsic, we could do this
// stuff in nir->nir pass
@@ -2799,7 +2799,12 @@ emit_stream_out(struct ir3_context *ctx)
orig_end_block->successors[0] = stream_out_block;
orig_end_block->successors[1] = new_end_block;
+
stream_out_block->successors[0] = new_end_block;
+ _mesa_set_add(stream_out_block->predecessors, orig_end_block);
+
+ _mesa_set_add(new_end_block->predecessors, orig_end_block);
+ _mesa_set_add(new_end_block->predecessors, stream_out_block);
/* setup 'if (vtxcnt < maxvtxcnt)' condition: */
cond = ir3_CMPS_S(ctx->block, vtxcnt, 0, maxvtxcnt, 0);