aco: fix sub-dword overwrite check in RA validator
authorRhys Perry <pendingchaos02@gmail.com>
Mon, 27 Apr 2020 19:52:20 +0000 (20:52 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 28 Apr 2020 23:16:55 +0000 (23:16 +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/4772>

src/amd/compiler/aco_validate.cpp

index 187155bededb28fa4ace692bea80c0abec7823bf..3323acf98996126fd351f8d5105856f7088e59ec 100644 (file)
@@ -591,7 +591,7 @@ bool validate_ra(Program *program, const struct radv_nir_compiler_options *optio
             }
             if (def.regClass().is_subdword() && !instr_can_access_subdword(instr)) {
                for (unsigned j = tmp.bytes(); j < 4; j++)
-                  if (reg.reg_b + j)
+                  if (regs[reg.reg_b + j])
                      err |= ra_fail(output, loc, assignments.at(regs[reg.reg_b + j]).defloc, "Assignment of element %d of %%%d overwrites the full register taken by %%%d from instruction", i, tmp.id(), regs[reg.reg_b + j]);
             }
          }