tree-optimization/98180 - fix BIT_INSERT_EXPR sequence vectorization
authorRichard Biener <rguenther@suse.de>
Tue, 8 Dec 2020 08:42:35 +0000 (09:42 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 8 Dec 2020 08:44:19 +0000 (09:44 +0100)
This adds a missing check for the first inserted value.

2020-12-08  Richard Biener  <rguenther@suse.de>

PR tree-optimization/98180
* tree-vect-slp.c (vect_slp_check_for_constructors): Check the
first inserted value has a def.

gcc/tree-vect-slp.c

index 2dccca02aa006498d59c2be4971418eb789bc9fa..a2757e707ffdd42eb15341811d80d984604164bf 100644 (file)
@@ -4193,10 +4193,12 @@ vect_slp_check_for_constructors (bb_vec_info bb_vinfo)
       else if (gimple_assign_rhs_code (assign) == BIT_INSERT_EXPR
               && VECTOR_TYPE_P (TREE_TYPE (rhs))
               && TYPE_VECTOR_SUBPARTS (TREE_TYPE (rhs)).is_constant ()
+              && TYPE_VECTOR_SUBPARTS (TREE_TYPE (rhs)).to_constant () > 1
               && integer_zerop (gimple_assign_rhs3 (assign))
               && useless_type_conversion_p
                    (TREE_TYPE (TREE_TYPE (rhs)),
-                    TREE_TYPE (gimple_assign_rhs2 (assign))))
+                    TREE_TYPE (gimple_assign_rhs2 (assign)))
+              && bb_vinfo->lookup_def (gimple_assign_rhs2 (assign)))
        {
          /* We start to match on insert to lane zero but since the
             inserts need not be ordered we'd have to search both