ac/llvm: fix missing casts in ac_build_readlane()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 23 Jan 2020 11:27:07 +0000 (12:27 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 24 Jan 2020 06:40:07 +0000 (07:40 +0100)
commita31bcf2be6eeb74797ee1c989f866e3365c670e1
treea7ea0ac1967f7a9e9206269b2d32392fcc2534c0
parent8a135ff6e5f5813c110ea0a4ae7d1f3c0cb37115
ac/llvm: fix missing casts in ac_build_readlane()

Because ac_build_optimization_barrier() overwrites the original
src_type, we have to keep track of it before emitting that barrier.
Otherwise, wrong conversions are expected for pointers or small
bitsizes.

By doing this, we no longer need to do the cast dance in
ac_build_readlane_no_opt_barrier(), it was just necessary for
ac_build_optimization_barrier().

This fixes a bunch of crashes with subgroups related tests when
RADV_DEBUG=checkir is enabled, and it also fixes a compiler crash
with The Surge 2.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2395
Fixes: 0f45d4dc2b1 ("ac: add ac_build_readlane without optimization barrier")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3535>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3535>
src/amd/llvm/ac_llvm_build.c