aco: handle missing second predecessors at merge block phis
authorRhys Perry <pendingchaos02@gmail.com>
Fri, 31 Jan 2020 12:41:19 +0000 (12:41 +0000)
committerMarge Bot <eric+marge@anholt.net>
Mon, 23 Mar 2020 15:55:12 +0000 (15:55 +0000)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3658>

src/amd/compiler/aco_instruction_selection.cpp

index 7b429f69350a65593c2877cad81d9fc47f26a6e3..3ffa6153d4629d34e312912020b0be2086a74024 100644 (file)
@@ -8253,6 +8253,10 @@ void visit_phi(isel_context *ctx, nir_phi_instr *instr)
             continue;
          }
       }
+      /* Handle missing predecessors at the end. This shouldn't happen with loop
+       * headers and we can't ignore these sources for loop header phis. */
+      if (!(ctx->block->kind & block_kind_loop_header) && cur_pred_idx >= preds.size())
+         continue;
       cur_pred_idx++;
       Operand op = get_phi_operand(ctx, src.second);
       operands[num_operands++] = op;