aco: fix more validation errors from vgpr spill/restore code
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 9 Jul 2020 17:03:21 +0000 (19:03 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 10 Jul 2020 06:28:33 +0000 (08:28 +0200)
It looks like the attempt to fix this in 1e791e51a65 was incomplete.

This fixes crashes with Devil May Cry 5 with a debug build.

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

src/amd/compiler/aco_spill.cpp

index 9b8833a64ba5f6efb7eb5d61640998c8df5bb986..62ab69a045be7cf8f9106d1b36151250a6a9a77f 100644 (file)
@@ -1571,7 +1571,7 @@ void assign_spill_slots(spill_ctx& ctx, unsigned spills_to_vgpr) {
                      split->definitions[i] = bld.def(v1);
                   bld.insert(split);
                   for (unsigned i = 0; i < temp.size(); i++)
-                     bld.mubuf(opcode, scratch_rsrc, Operand(), scratch_offset, split->definitions[i].getTemp(), offset + i * 4, false);
+                     bld.mubuf(opcode, scratch_rsrc, Operand(v1), scratch_offset, split->definitions[i].getTemp(), offset + i * 4, false);
                } else {
                   bld.mubuf(opcode, scratch_rsrc, Operand(v1), scratch_offset, temp, offset, false);
                }
@@ -1637,7 +1637,7 @@ void assign_spill_slots(spill_ctx& ctx, unsigned spills_to_vgpr) {
                   for (unsigned i = 0; i < def.size(); i++) {
                      Temp tmp = bld.tmp(v1);
                      vec->operands[i] = Operand(tmp);
-                     bld.mubuf(opcode, Definition(tmp), scratch_rsrc, Operand(), scratch_offset, offset + i * 4, false);
+                     bld.mubuf(opcode, Definition(tmp), scratch_rsrc, Operand(v1), scratch_offset, offset + i * 4, false);
                   }
                   bld.insert(vec);
                } else {