ir3: Prevent oob writes to inputs/outputs array
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 22 Apr 2021 13:52:05 +0000 (15:52 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 26 Apr 2021 17:07:02 +0000 (17:07 +0000)
commitdecfea2f4e8128afeb6d4bb0d0c9c0740a01f766
treef1e7613c2da382716fb4de9d840b21f2b685f725
parentb2b8b6c0e3c8a76b6a1946e7a2a342363cefd8f8
ir3: Prevent oob writes to inputs/outputs array

Don't setup inputs and outputs if we aren't using
load_input/store_output intrinsics. While it's mostly harmless, there
may be more outputs than expected which would lead to an oob write of
the outputs array when setting the register id to INVALID_REG.

Also be more paranoid with asserts to catch this.

Fixes: a6291b1 ("freedreno/ir3: rework setup_{input,output} to make struct varyings work")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7274>
src/freedreno/ir3/ir3_compiler_nir.c