Mesa (main): freedreno/ir3: Improve error msg for block level validation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Sep 8 09:12:10 UTC 2021
Module: Mesa
Branch: main
Commit: 137471ca8998beb779e2bd2603ab25827817dce6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=137471ca8998beb779e2bd2603ab25827817dce6
Author: Rob Clark <robdclark at chromium.org>
Date: Tue Sep 7 14:45:51 2021 -0700
freedreno/ir3: Improve error msg for block level validation
Printing whatever happened to be the last instruction is misleading.
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12742>
---
src/freedreno/ir3/ir3_validate.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/freedreno/ir3/ir3_validate.c b/src/freedreno/ir3/ir3_validate.c
index 51955b8d541..8365c612277 100644
--- a/src/freedreno/ir3/ir3_validate.c
+++ b/src/freedreno/ir3/ir3_validate.c
@@ -30,6 +30,9 @@
struct ir3_validate_ctx {
struct ir3 *ir;
+ /* Current block being validated: */
+ struct ir3_block *current_block;
+
/* Current instruction being validated: */
struct ir3_instruction *current_instr;
@@ -43,8 +46,12 @@ static void
validate_error(struct ir3_validate_ctx *ctx, const char *condstr)
{
fprintf(stderr, "validation fail: %s\n", condstr);
- fprintf(stderr, " -> for instruction: ");
- ir3_print_instr(ctx->current_instr);
+ if (ctx->current_instr) {
+ fprintf(stderr, " -> for instruction: ");
+ ir3_print_instr(ctx->current_instr);
+ } else {
+ fprintf(stderr, " -> for block%u\n", block_id(ctx->current_block));
+ }
abort();
}
@@ -363,6 +370,9 @@ ir3_validate(struct ir3 *ir)
ctx->defs = _mesa_pointer_set_create(ctx);
foreach_block (block, &ir->block_list) {
+ ctx->current_block = block;
+ ctx->current_instr = NULL;
+
/* We require that the first block does not have any predecessors,
* which allows us to assume that phi nodes and meta:input's do not
* appear in the same basic block.
@@ -387,6 +397,8 @@ ir3_validate(struct ir3 *ir)
if (block->successors[i]) {
validate_phi_src(ctx, block->successors[i], block);
+ ctx->current_instr = NULL;
+
/* Each logical successor should also be a physical successor: */
validate_assert(ctx, is_physical_successor(block, block->successors[i]));
}
More information about the mesa-commit
mailing list