aco: a couple loop handling fixes for GFX10 hazard pass
authorRhys Perry <pendingchaos02@gmail.com>
Tue, 29 Oct 2019 11:19:39 +0000 (11:19 +0000)
committerDaniel Schürmann <daniel@schuermann.dev>
Wed, 30 Oct 2019 18:13:53 +0000 (18:13 +0000)
It was joining from the wrong blocks and block.kind is a bitmask instead
of an enum.

Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
src/amd/compiler/aco_insert_NOPs.cpp

index 5296f6ac0452121ad062c3602aa948f58440545b..2c69407b80806b2da32f6dabd879626882dc33e1 100644 (file)
@@ -560,13 +560,13 @@ void mitigate_hazards_gfx10(Program *program)
       Block& block = program->blocks[i];
       NOP_ctx_gfx10 &ctx = all_ctx[i];
 
-      if (block.kind == block_kind_loop_header) {
+      if (block.kind & block_kind_loop_header) {
          loop_header_indices.push(i);
-      } else if (block.kind == block_kind_loop_exit) {
+      } else if (block.kind & block_kind_loop_exit) {
          /* Go through the whole loop again */
          for (unsigned idx = loop_header_indices.top(); idx < i; idx++) {
             NOP_ctx_gfx10 loop_block_ctx;
-            for (unsigned b : block.linear_preds)
+            for (unsigned b : program->blocks[idx].linear_preds)
                loop_block_ctx.join(all_ctx[b]);
 
             handle_block_gfx10(loop_block_ctx, program->blocks[idx]);