GCC with patches for OS216
Revisión | 628b78f9794a2eefcbc578011806bfa8e09b9ef7 (tree) |
---|---|
Tiempo | 2020-06-25 22:56:06 |
Autor | Richard Biener <rguenther@suse...> |
Commiter | Richard Biener |
tree-optimization/95839 - allow CTOR vectorization without loads
This removes a premature check for enough datarefs in a basic-block
before we consider vectorizing it which leaves basic-blocks with
just vectorizable vector constructors unvectorized. The check
is effectively done by the following check for store groups
which then also include constructors.
2020-06-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/95839
* tree-vect-slp.c (vect_slp_analyze_bb_1): Remove premature
check on the number of datarefs.
* gcc.dg/vect/bb-slp-pr95839.c: New testcase.
@@ -0,0 +1,13 @@ | ||
1 | +/* { dg-do compile } */ | |
2 | +/* { dg-require-effective-target vect_float } */ | |
3 | +/* { dg-additional-options "-w -Wno-psabi" } */ | |
4 | + | |
5 | +typedef float __attribute__((vector_size(16))) v4f32; | |
6 | + | |
7 | +v4f32 f(v4f32 a, v4f32 b) | |
8 | +{ | |
9 | + /* Check that we vectorize this CTOR without any loads. */ | |
10 | + return (v4f32){a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]}; | |
11 | +} | |
12 | + | |
13 | +/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */ |
@@ -3149,15 +3149,6 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int n_stmts, bool &fatal) | ||
3149 | 3149 | return false; |
3150 | 3150 | } |
3151 | 3151 | |
3152 | - if (BB_VINFO_DATAREFS (bb_vinfo).length () < 2) | |
3153 | - { | |
3154 | - if (dump_enabled_p ()) | |
3155 | - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, | |
3156 | - "not vectorized: not enough data-refs in " | |
3157 | - "basic block.\n"); | |
3158 | - return false; | |
3159 | - } | |
3160 | - | |
3161 | 3152 | if (!vect_analyze_data_ref_accesses (bb_vinfo)) |
3162 | 3153 | { |
3163 | 3154 | if (dump_enabled_p ()) |
@@ -3169,9 +3160,9 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int n_stmts, bool &fatal) | ||
3169 | 3160 | |
3170 | 3161 | vect_slp_check_for_constructors (bb_vinfo); |
3171 | 3162 | |
3172 | - /* If there are no grouped stores in the region there is no need | |
3173 | - to continue with pattern recog as vect_analyze_slp will fail | |
3174 | - anyway. */ | |
3163 | + /* If there are no grouped stores and no constructors in the region | |
3164 | + there is no need to continue with pattern recog as vect_analyze_slp | |
3165 | + will fail anyway. */ | |
3175 | 3166 | if (bb_vinfo->grouped_stores.is_empty ()) |
3176 | 3167 | { |
3177 | 3168 | if (dump_enabled_p ()) |