Mesa (master): pan/mdg: Return false instead of asserting in mir_args_ssa

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 1 03:14:24 UTC 2021


Module: Mesa
Branch: master
Commit: b7f2619798ae2867c8ee22593130d86c2c8525ea
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7f2619798ae2867c8ee22593130d86c2c8525ea

Author: Icecream95 <ixn at disroot.org>
Date:   Fri Jan  1 01:44:04 2021 +1300

pan/mdg: Return false instead of asserting in mir_args_ssa

mir_args_ssa asserted that the given number of arguments to use is
greater than or equal to the actual number, but this is not checked by
callers, so instead of crashing return false to mark failure.

Fixes the local memory atomics OpenCL tests in Piglit.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8264>

---

 src/panfrost/midgard/midgard_address.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/midgard/midgard_address.c b/src/panfrost/midgard/midgard_address.c
index 22411c3606e..310d7927360 100644
--- a/src/panfrost/midgard/midgard_address.c
+++ b/src/panfrost/midgard/midgard_address.c
@@ -55,7 +55,9 @@ static bool
 mir_args_ssa(nir_ssa_scalar s, unsigned count)
 {
         nir_alu_instr *alu = nir_instr_as_alu(s.def->parent_instr);
-        assert(count <= nir_op_infos[alu->op].num_inputs);
+
+        if (count > nir_op_infos[alu->op].num_inputs)
+                return false;
 
         for (unsigned i = 0; i < count; ++i) {
                 if (!alu->src[i].src.is_ssa)



More information about the mesa-commit mailing list