@@ -163,169 +163,6 @@ static void vect_estimate_min_profitable_iters (loop_vec_info, int *, int *,
163163static stmt_vec_info vect_is_simple_reduction (loop_vec_info, stmt_vec_info,
164164 bool *, bool *, bool );
165165
166- /* Subroutine of vect_determine_vf_for_stmt that handles only one
167- statement. VECTYPE_MAYBE_SET_P is true if STMT_VINFO_VECTYPE
168- may already be set for general statements (not just data refs). */
169-
170- static opt_result
171- vect_determine_vectype_for_stmt_1 (vec_info *vinfo, stmt_vec_info stmt_info,
172- bool vectype_maybe_set_p)
173- {
174- gimple *stmt = stmt_info->stmt ;
175-
176- if ((!STMT_VINFO_RELEVANT_P (stmt_info)
177- && !STMT_VINFO_LIVE_P (stmt_info))
178- || gimple_clobber_p (stmt))
179- {
180- if (dump_enabled_p ())
181- dump_printf_loc (MSG_NOTE, vect_location, " skip.\n " );
182- return opt_result::success ();
183- }
184-
185- tree stmt_vectype, nunits_vectype;
186- opt_result res = vect_get_vector_types_for_stmt (vinfo, stmt_info,
187- &stmt_vectype,
188- &nunits_vectype);
189- if (!res)
190- return res;
191-
192- if (stmt_vectype)
193- {
194- if (STMT_VINFO_VECTYPE (stmt_info))
195- /* The only case when a vectype had been already set is for stmts
196- that contain a data ref, or for "pattern-stmts" (stmts generated
197- by the vectorizer to represent/replace a certain idiom). */
198- gcc_assert ((STMT_VINFO_DATA_REF (stmt_info)
199- || vectype_maybe_set_p)
200- && STMT_VINFO_VECTYPE (stmt_info) == stmt_vectype);
201- else
202- STMT_VINFO_VECTYPE (stmt_info) = stmt_vectype;
203- }
204-
205- return opt_result::success ();
206- }
207-
208- /* Subroutine of vect_determine_vectorization_factor. Set the vector
209- types of STMT_INFO and all attached pattern statements and update
210- the vectorization factor VF accordingly. Return true on success
211- or false if something prevented vectorization. */
212-
213- static opt_result
214- vect_determine_vectype_for_stmt (vec_info *vinfo, stmt_vec_info stmt_info)
215- {
216- if (dump_enabled_p ())
217- dump_printf_loc (MSG_NOTE, vect_location, " ==> examining statement: %G" ,
218- stmt_info->stmt );
219- opt_result res = vect_determine_vectype_for_stmt_1 (vinfo, stmt_info, false );
220- if (!res)
221- return res;
222-
223- if (STMT_VINFO_IN_PATTERN_P (stmt_info)
224- && STMT_VINFO_RELATED_STMT (stmt_info))
225- {
226- gimple *pattern_def_seq = STMT_VINFO_PATTERN_DEF_SEQ (stmt_info);
227- stmt_info = STMT_VINFO_RELATED_STMT (stmt_info);
228-
229- /* If a pattern statement has def stmts, analyze them too. */
230- for (gimple_stmt_iterator si = gsi_start (pattern_def_seq);
231- !gsi_end_p (si); gsi_next (&si))
232- {
233- stmt_vec_info def_stmt_info = vinfo->lookup_stmt (gsi_stmt (si));
234- if (dump_enabled_p ())
235- dump_printf_loc (MSG_NOTE, vect_location,
236- " ==> examining pattern def stmt: %G" ,
237- def_stmt_info->stmt );
238- res = vect_determine_vectype_for_stmt_1 (vinfo, def_stmt_info, true );
239- if (!res)
240- return res;
241- }
242-
243- if (dump_enabled_p ())
244- dump_printf_loc (MSG_NOTE, vect_location,
245- " ==> examining pattern statement: %G" ,
246- stmt_info->stmt );
247- res = vect_determine_vectype_for_stmt_1 (vinfo, stmt_info, true );
248- if (!res)
249- return res;
250- }
251-
252- return opt_result::success ();
253- }
254-
255- /* Function vect_set_stmts_vectype
256-
257- Set STMT_VINFO_VECTYPE of all stmts. */
258-
259- static opt_result
260- vect_set_stmts_vectype (loop_vec_info loop_vinfo)
261- {
262- class loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
263- basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
264- unsigned nbbs = loop->num_nodes ;
265- tree scalar_type = NULL_TREE;
266- gphi *phi;
267- tree vectype;
268- stmt_vec_info stmt_info;
269- unsigned i;
270-
271- DUMP_VECT_SCOPE (" vect_set_stmts_vectype" );
272-
273- for (i = 0 ; i < nbbs; i++)
274- {
275- basic_block bb = bbs[i];
276-
277- for (gphi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
278- gsi_next (&si))
279- {
280- phi = si.phi ();
281- stmt_info = loop_vinfo->lookup_stmt (phi);
282- if (dump_enabled_p ())
283- dump_printf_loc (MSG_NOTE, vect_location, " ==> examining phi: %G" ,
284- (gimple *) phi);
285-
286- gcc_assert (stmt_info);
287-
288- if (STMT_VINFO_RELEVANT_P (stmt_info)
289- || STMT_VINFO_LIVE_P (stmt_info))
290- {
291- gcc_assert (!STMT_VINFO_VECTYPE (stmt_info));
292- scalar_type = TREE_TYPE (PHI_RESULT (phi));
293-
294- if (dump_enabled_p ())
295- dump_printf_loc (MSG_NOTE, vect_location,
296- " get vectype for scalar type: %T\n " ,
297- scalar_type);
298-
299- vectype = get_vectype_for_scalar_type (loop_vinfo, scalar_type);
300- if (!vectype)
301- return opt_result::failure_at (phi,
302- " not vectorized: unsupported "
303- " data-type %T\n " ,
304- scalar_type);
305- STMT_VINFO_VECTYPE (stmt_info) = vectype;
306-
307- if (dump_enabled_p ())
308- dump_printf_loc (MSG_NOTE, vect_location, " vectype: %T\n " ,
309- vectype);
310- }
311- }
312-
313- for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si);
314- gsi_next (&si))
315- {
316- if (is_gimple_debug (gsi_stmt (si)))
317- continue ;
318- stmt_info = loop_vinfo->lookup_stmt (gsi_stmt (si));
319- opt_result res
320- = vect_determine_vectype_for_stmt (loop_vinfo, stmt_info);
321- if (!res)
322- return res;
323- }
324- }
325-
326- return opt_result::success ();
327- }
328-
329166
330167/* Function vect_is_simple_iv_evolution.
331168
@@ -2483,15 +2320,6 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal,
24832320 }
24842321 LOOP_VINFO_MAX_VECT_FACTOR (loop_vinfo) = max_vf;
24852322
2486- ok = vect_set_stmts_vectype (loop_vinfo);
2487- if (!ok)
2488- {
2489- if (dump_enabled_p ())
2490- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
2491- " cannot determine vector types.\n " );
2492- return ok;
2493- }
2494-
24952323 /* Compute the scalar iteration cost. */
24962324 vect_compute_single_scalar_iteration_cost (loop_vinfo);
24972325
0 commit comments