Mesa (staging/20.2): nir: skip bcsel with non-trivial swizzle in opt_simplify_bcsel_of_phi()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Nov 18 00:47:17 UTC 2020
Module: Mesa
Branch: staging/20.2
Commit: dbbbf27dead9a19cf5d9543d5b401e1e15982d81
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbbbf27dead9a19cf5d9543d5b401e1e15982d81
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Tue Nov 3 13:21:37 2020 +0000
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 at gmail.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Fixes: b031c643491 ("nir: Convert a bcsel with only phi node sources to a phi node")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7426>
(cherry picked from commit 233a820f2c3fb0a008a84a16a0920c3bbdbd61f5)
---
.pick_status.json | 2 +-
src/compiler/nir/nir_opt_if.c | 11 +++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 8891567290b..7631b18f607 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4477,7 +4477,7 @@
"description": "nir: skip bcsel with non-trivial swizzle in opt_simplify_bcsel_of_phi()",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "b031c643491a92a5574c7a4bd659df33f2d89bb6"
},
diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c
index c04a7d69f5f..258178d5b52 100644
--- a/src/compiler/nir/nir_opt_if.c
+++ b/src/compiler/nir/nir_opt_if.c
@@ -644,14 +644,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;
}
More information about the mesa-commit
mailing list