]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/101159 - fix missing NULL check in popcount pattern
authorRichard Biener <rguenther@suse.de>
Tue, 22 Jun 2021 07:12:42 +0000 (09:12 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 22 Jun 2021 09:01:17 +0000 (11:01 +0200)
This fixes a missing check for a NULL vectype in the new popcount
pattern.

2021-06-22  Richard Biener  <rguenther@suse.de>

PR tree-optimization/101159
* tree-vect-patterns.c (vect_recog_popcount_pattern): Add
missing NULL vectype check.

gcc/tree-vect-patterns.c

index 59727056dc7dfa240557e617cb7f08242bcf3945..d0a5c71dbe497ad4b967cba8ee21e7f06dd55690 100644 (file)
@@ -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 popcount<vector_mode>2.  */
-  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).  */