pan/bi: Assume SSA for helper invocation analysis
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 25 Jul 2022 19:14:52 +0000 (15:14 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 16:03:23 +0000 (16:03 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17794>

src/panfrost/bifrost/bi_helper_invocations.c

index 144116e..82bb973 100644 (file)
@@ -202,15 +202,14 @@ bi_helper_block_update(BITSET_WORD *deps, bi_block *block)
         bi_foreach_instr_in_block_rev(block, I) {
                 /* If a destination is required by helper invocation... */
                 bi_foreach_dest(I, d) {
-                        if (!BITSET_TEST(deps, bi_get_node(I->dest[d])))
+                        if (!BITSET_TEST(deps, I->dest[d].value))
                                 continue;
 
                         /* ...so are the sources */
                         bi_foreach_src(I, s) {
-                                if (I->src[s].type == BI_INDEX_NORMAL) {
-                                        unsigned node = bi_get_node(I->src[s]);
-                                        progress |= !BITSET_TEST(deps, node);
-                                        BITSET_SET(deps, node);
+                                if (bi_is_ssa(I->src[s])) {
+                                        progress |= !BITSET_TEST(deps, I->src[s].value);
+                                        BITSET_SET(deps, I->src[s].value);
                                 }
                         }
 
@@ -224,8 +223,7 @@ bi_helper_block_update(BITSET_WORD *deps, bi_block *block)
 void
 bi_analyze_helper_requirements(bi_context *ctx)
 {
-        unsigned temp_count = bi_max_temp(ctx);
-        BITSET_WORD *deps = calloc(sizeof(BITSET_WORD), BITSET_WORDS(temp_count));
+        BITSET_WORD *deps = calloc(sizeof(BITSET_WORD), ctx->ssa_alloc);
 
         /* Initialize with the sources of instructions consuming
          * derivatives */
@@ -234,8 +232,8 @@ bi_analyze_helper_requirements(bi_context *ctx)
                 if (!bi_instr_uses_helpers(I)) continue;
 
                 bi_foreach_src(I, s) {
-                        if (I->src[s].type == BI_INDEX_NORMAL)
-                                BITSET_SET(deps, bi_get_node(I->src[s]));
+                        if (bi_is_ssa(I->src[s]))
+                                BITSET_SET(deps, I->src[s].value);
                 }
         }
 
@@ -266,8 +264,8 @@ bi_analyze_helper_requirements(bi_context *ctx)
                 bool exec = false;
 
                 bi_foreach_dest(I, d) {
-                        assert(I->dest[d].type == BI_INDEX_NORMAL);
-                        exec |= BITSET_TEST(deps, bi_get_node(I->dest[d]));
+                        assert(bi_is_ssa(I->dest[d]));
+                        exec |= BITSET_TEST(deps, I->dest[d].value);
                 }
 
                 I->skip = !exec;