aco: use the same regclass as the definition for undef phi operands
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 18 Jun 2020 12:52:28 +0000 (13:52 +0100)
committerMarge Bot <eric+marge@anholt.net>
Thu, 18 Jun 2020 17:29:33 +0000 (17:29 +0000)
Subdword phis can't have SGPR operands on GFX6-8.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5544>

src/amd/compiler/aco_instruction_selection.cpp

index c0cc445ffa38bd5fbd1863f644ee3c961304384c..4de1b4e8b8183ed1b0efcdad4173c3df482be774 100644 (file)
@@ -8890,11 +8890,11 @@ void visit_tex(isel_context *ctx, nir_tex_instr *instr)
 }
 
 
-Operand get_phi_operand(isel_context *ctx, nir_ssa_def *ssa)
+Operand get_phi_operand(isel_context *ctx, nir_ssa_def *ssa, RegClass rc)
 {
    Temp tmp = get_ssa_temp(ctx, ssa);
    if (ssa->parent_instr->type == nir_instr_type_ssa_undef)
-      return Operand(tmp.regClass());
+      return Operand(rc);
    else
       return Operand(tmp);
 }
@@ -8939,7 +8939,7 @@ void visit_phi(isel_context *ctx, nir_phi_instr *instr)
       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);
+      Operand op = get_phi_operand(ctx, src.second, dst.regClass());
       operands[num_operands++] = op;
       num_defined += !op.isUndefined();
    }