intel/compiler: make sure swizzle is applied to if condition
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 29 Jul 2021 02:14:16 +0000 (12:14 +1000)
committerMarge Bot <eric+marge@anholt.net>
Tue, 3 Aug 2021 10:54:50 +0000 (10:54 +0000)
commita654e39f1559edc06eb12bdd6f2372694dcd8911
treedd3ce43f7ba2bfc2cdbed3b232f78c4ec9bfd867
parent4f7043fc0ce158a5f555b6c0ec7f9818a60b8ce4
intel/compiler: make sure swizzle is applied to if condition

This fixes a hang in the following piglit test when GCM moves a
UBO load outside of the loop.

tests/shaders/ssa/fs-if-def-else-break.shader_test

The end NIR ends up looking like this:

vec2 32 ssa_3 = intrinsic load_ubo (ssa_2, ssa_0) (0, 1073741824, 0, 0, 8)
vec1 32 ssa_4 = mov ssa_3.x
vec1 32 ssa_5 = inot ssa_3.y
/* succs: block_1 */
loop {
           ...
           if ssa_5 { }
        }

Fixes: 1edf67fc3f6b ("intel/fs: Generate if instructions with inverted conditions")

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12064>
src/intel/compiler/brw_fs_nir.cpp