From: Richard Biener Date: Tue, 22 Jun 2021 07:12:42 +0000 (+0200) Subject: tree-optimization/101159 - fix missing NULL check in popcount pattern X-Git-Tag: basepoints/gcc-13~6599 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a5b773d3f86dd4333696cab0fe3a6953d3db74a3;p=thirdparty%2Fgcc.git tree-optimization/101159 - fix missing NULL check in popcount pattern This fixes a missing check for a NULL vectype in the new popcount pattern. 2021-06-22 Richard Biener PR tree-optimization/101159 * tree-vect-patterns.c (vect_recog_popcount_pattern): Add missing NULL vectype check. --- diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 59727056dc7d..d0a5c71dbe49 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -1385,9 +1385,9 @@ vect_recog_popcount_pattern (vec_info *vinfo, vect_pattern_detected ("vec_regcog_popcount_pattern", popcount_stmt); vec_type = get_vectype_for_scalar_type (vinfo, lhs_type); /* Do it only the backend existed popcount2. */ - if (!direct_internal_fn_supported_p (IFN_POPCOUNT, - vec_type, - OPTIMIZE_FOR_SPEED)) + if (!vec_type + || !direct_internal_fn_supported_p (IFN_POPCOUNT, vec_type, + OPTIMIZE_FOR_SPEED)) return NULL; /* Create B = .POPCOUNT (A). */