From ad5fcac005876b5e743281b4198b55a0886fbe0d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 3 Oct 2019 21:29:59 -0400 Subject: [PATCH] pan/midgard: Invalidate liveness for mir_is_live_after Callers should have liveness info ready. Ideally we'd have a nice metadata tracking framework like NIR to handle this automatically, but for now this will allow us to make forward progress... when we're about to do something with liveness, invalidate everything ahead to force a clean calculation. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_liveness.c | 2 ++ src/panfrost/midgard/midgard_opt_dce.c | 2 ++ src/panfrost/midgard/midgard_ra_pipeline.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/panfrost/midgard/midgard_liveness.c b/src/panfrost/midgard/midgard_liveness.c index b432ca43b47..4aceab7e3bc 100644 --- a/src/panfrost/midgard/midgard_liveness.c +++ b/src/panfrost/midgard/midgard_liveness.c @@ -226,6 +226,8 @@ is_live_after_successors(compiler_context *ctx, midgard_block *bl, int src) bool mir_is_live_after(compiler_context *ctx, midgard_block *block, midgard_instruction *start, int src) { + assert(ctx->metadata & MIDGARD_METADATA_LIVENESS); + /* Check the rest of the block for liveness */ mir_foreach_instr_in_block_from(block, ins, mir_next_op(start)) { diff --git a/src/panfrost/midgard/midgard_opt_dce.c b/src/panfrost/midgard/midgard_opt_dce.c index 764a5ff6030..613eb6e5b1d 100644 --- a/src/panfrost/midgard/midgard_opt_dce.c +++ b/src/panfrost/midgard/midgard_opt_dce.c @@ -31,6 +31,8 @@ midgard_opt_dead_code_eliminate(compiler_context *ctx, midgard_block *block) { bool progress = false; + mir_invalidate_liveness(ctx); + mir_foreach_instr_in_block_safe(block, ins) { if (ins->type != TAG_ALU_4) continue; if (ins->compact_branch) continue; diff --git a/src/panfrost/midgard/midgard_ra_pipeline.c b/src/panfrost/midgard/midgard_ra_pipeline.c index 1dea92d053a..3fa3e9fbecd 100644 --- a/src/panfrost/midgard/midgard_ra_pipeline.c +++ b/src/panfrost/midgard/midgard_ra_pipeline.c @@ -106,6 +106,8 @@ mir_pipeline_ins( void mir_create_pipeline_registers(compiler_context *ctx) { + mir_invalidate_liveness(ctx); + mir_foreach_block(ctx, block) { mir_foreach_bundle_in_block(block, bundle) { if (!mir_is_alu_bundle(bundle)) continue; -- 2.30.2