pan/midgard: Invalidate liveness for mir_is_live_after
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 4 Oct 2019 01:29:59 +0000 (21:29 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 4 Oct 2019 02:29:51 +0000 (22:29 -0400)
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 <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/midgard_liveness.c
src/panfrost/midgard/midgard_opt_dce.c
src/panfrost/midgard/midgard_ra_pipeline.c

index b432ca43b47c51ce22cac07b3f210e2088674dbf..4aceab7e3bc9e867777211b61c3b6be54fb98ba7 100644 (file)
@@ -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)) {
index 764a5ff60301d14fef9f9381f4b22df25eb6ac7c..613eb6e5b1d61ad18d29576d3c5b00d177c9e573 100644 (file)
@@ -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;
index 1dea92d053afbe363d60371181542aa7e739dbd4..3fa3e9fbecd4055dbfc85a5247cc930900f48f2b 100644 (file)
@@ -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;