[patch] enabling vectorization by default at -O3
Sun Dec 23 16:19:00 GMT 2007
> Jan Hubicka <email@example.com> wrote on 06/09/2007:
> > Jan Hubicka <firstname.lastname@example.org> wrote on 06/09/2007 15:12:10:
> > > I definitly like the idea of enabling more loop optimization stuff at
> > > -O3 in general. If the vectorizer is able to trottle down itself on
> > > cold loops or loops not iterating much at average, I would suggest
> > > enabling it also with -fprofile-use.
> > >
> > we don't use profile information yet in the vectorizer, but we sure
> > will look into it (maybe after we finish stabilizing it for -O3)
> It should be quite easy - basically you have maybe_hot_bb_p that you can
> run at inner BB of the loop. If the loop is cold, you should optimize
> for size (ie probably not vectorize at all).
Just wanted to let you know that I have been looking into having the
vectorizer use profile information along the lines you suggested (see
attached patch). Initial experimentation with partial SPEC2006 runs on
PowerPC however shows that enabling profiling (even without the patch)
degrades performance, so this requires closer investigation... I'll
continue to look into this.
--- tree-vect-analyze.c (revision 129124)
+++ tree-vect-analyze.c (working copy)
@@ -622,6 +622,20 @@ vect_analyze_operations (loop_vec_info l
+ if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ && loop->header->count
+ && expected_loop_iterations (loop) <= th)
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ fprintf (vect_dump, "not vectorized: vectorization probably not "
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "not vectorized: expected iteration count
+ "than user specified loop bound parameter or minimum "
+ "profitable iterations (whichever is more
+ return false;
if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
|| LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor != 0).
|| LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo))
@@ -4172,6 +4186,16 @@ vect_analyze_loop_form (struct loop *loo
destroy_loop_vec_info (inner_loop_vinfo, false);
+ if (loop->header->count && !maybe_hot_bb_p (loop->header))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)))
+ fprintf (vect_dump, "not vectorized: cold loop.");))
+ if (inner_loop_vinfo)
+ destroy_loop_vec_info (inner_loop_vinfo, false););))
+ return NULL;
loop_vinfo = new_loop_vec_info (loop);
LOOP_VINFO_NITERS (loop_vinfo) = number_of_iterations;);))
More information about the Gcc-patches