aco/ra: fix get_reg_for_operand() when the blocking var is a vector
authorRhys Perry <pendingchaos02@gmail.com>
Fri, 23 Apr 2021 13:31:04 +0000 (14:31 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 17 May 2021 13:31:07 +0000 (13:31 +0000)
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/10459>

src/amd/compiler/aco_register_allocation.cpp
src/amd/compiler/tests/test_regalloc.cpp

index 0eb52ec..583fb25 100644 (file)
@@ -1740,7 +1740,7 @@ void get_reg_for_operand(ra_ctx& ctx, RegisterFile& register_file,
          uint32_t blocking_id = register_file[operand.physReg()];
          RegClass rc = ctx.assignments[blocking_id].rc;
          Operand pc_op = Operand(Temp{blocking_id, rc});
-         pc_op.setFixed(operand.physReg());
+         pc_op.setFixed(ctx.assignments[blocking_id].reg);
 
          /* make space in the register file for get_reg() and then block the target reg */
          register_file.clear(src, operand.regClass());
index 2f1565d..65a3374 100644 (file)
@@ -96,3 +96,20 @@ BEGIN_TEST(regalloc.precolor.swap)
 
    finish_ra_test(ra_test_policy());
 END_TEST
+
+BEGIN_TEST(regalloc.precolor.blocking_vector)
+   //>> s2: %tmp0:s[0-1], s1: %tmp1:s[2] = p_startpgm
+   if (!setup_cs("s2 s1", GFX10))
+      return;
+
+   //! s2: %tmp0_2:s[2-3], s1: %tmp1_2:s[1] = p_parallelcopy %tmp0:s[0-1], %tmp1:s[2]
+   //! p_unit_test %tmp1_2:s[1]
+   Operand op(inputs[1]);
+   op.setFixed(PhysReg(1));
+   bld.pseudo(aco_opcode::p_unit_test, op);
+
+   //! p_unit_test %tmp0_2:s[2-3]
+   bld.pseudo(aco_opcode::p_unit_test, inputs[0]);
+
+   finish_ra_test(ra_test_policy());
+END_TEST