nir: skip bcsel with non-trivial swizzle in opt_simplify_bcsel_of_phi()

Fixes validation error in a Dota 2 shader.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Fixes: b031c64349 ("nir: Convert a bcsel with only phi node sources to a phi node")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7426>
This commit is contained in:
Rhys Perry 2020-11-03 13:21:37 +00:00 committed by Marge Bot
parent 1df2fc9f9c
commit 233a820f2c

View file

@ -635,14 +635,13 @@ opt_simplify_bcsel_of_phi(nir_builder *b, nir_loop *loop)
bool match = true;
for (unsigned i = 0; i < 3; i++) {
/* FINISHME: The abs and negate cases could be handled by adding
* move instructions at the bottom of the continue block and more
* phi nodes in the header_block.
/* FINISHME: The abs, negate and swizzled cases could be handled by
* adding move instructions at the bottom of the continue block and
* more phi nodes in the header_block.
*/
if (!bcsel->src[i].src.is_ssa ||
if (!nir_alu_src_is_trivial_ssa(bcsel, i) ||
bcsel->src[i].src.ssa->parent_instr->type != nir_instr_type_phi ||
bcsel->src[i].src.ssa->parent_instr->block != header_block ||
bcsel->src[i].negate || bcsel->src[i].abs) {
bcsel->src[i].src.ssa->parent_instr->block != header_block) {
match = false;
break;
}