summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-08-30 10:48:41 -0700
committerAlyssa Rosenzweig <[email protected]>2019-08-30 15:50:26 -0700
commit72cbd2d4e77c782fa67b96ab12e2d2ed60cc7fb7 (patch)
tree544acbb3a2675e9f82e42f359e588a2d95eaf8c8
parentbcc59ff04df2f2270de3931aa5cf7dcda248bf6f (diff)
pan/midgard: Allow NULL argument in mir_has_arg
It's sometimes convenient to call this with no instruction specified. By definition, a missing instruction cannot reference any argument, so let's check for NULL and shortciruit to false. Signed-off-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r--src/panfrost/midgard/compiler.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h
index cc63b6ce7c7..201999359cf 100644
--- a/src/panfrost/midgard/compiler.h
+++ b/src/panfrost/midgard/compiler.h
@@ -566,6 +566,9 @@ v_mov(unsigned src, midgard_vector_alu_src mod, unsigned dest)
static inline bool
mir_has_arg(midgard_instruction *ins, unsigned arg)
{
+ if (!ins)
+ return false;
+
for (unsigned i = 0; i < ARRAY_SIZE(ins->src); ++i) {
if (ins->src[i] == arg)
return true;