nir/search: Fix possible NULL dereference in is_fsign
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 15 Jul 2019 22:18:47 +0000 (15:18 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 17 Oct 2019 22:07:01 +0000 (15:07 -0700)
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fixes: 09705747d72 ("nir/algebraic: Reassociate fadd into fmul in DPH-like pattern")
src/compiler/nir/nir_search_helpers.h

index a52104c7109007c47a142fbfc7f1a60d89f1e936..90ba897742d63e64ee27aa0042608b7ef7a18bb7 100644 (file)
@@ -209,7 +209,7 @@ is_fsign(nir_alu_instr *instr, unsigned src,
    if (src_alu->op == nir_op_fneg)
       src_alu = nir_src_as_alu_instr(src_alu->src[0].src);
 
-   return src_alu->op == nir_op_fsign;
+   return src_alu != NULL && src_alu->op == nir_op_fsign;
 }
 
 static inline bool