[Bug target/80634] strangely missed vectorization optimizations

2017-05-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80634

Richard Biener  changed:

   What|Removed |Added

 Target||x86_64-*-*, i?86-*-*
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-05-05
 CC||rguenth at gcc dot gnu.org
 Blocks||53947
 Ever confirmed|0   |1

--- Comment #4 from Richard Biener  ---
Confirmed.  Yet another example where the alingment peeling is confused by the
vectorizer cost model of the target (well -- not entirely so but clearly that's
part of the story).

There's some niter-based cost modeling going on as well that's very
conservative
at the moment:

  /* Cost model #2 - if peeling may result in a remaining loop not
 iterating enough to be vectorized then do not peel.  */
  if (do_peeling
  && LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
{
  unsigned max_peel
= npeel == 0 ? LOOP_VINFO_VECT_FACTOR (loop_vinfo) - 1 : npeel;
  if (LOOP_VINFO_INT_NITERS (loop_vinfo)
  < LOOP_VINFO_VECT_FACTOR (loop_vinfo) + max_peel)
do_peeling = false;
}

so it just ensures the remaining vector loop would iterate at least once.  But
in reality it should use the full cost model, thus looking at the peeling cost,
esp. if we need to add a epilogue.  That's not easily possible right now so
some better heuristic is needed here, like pessimizing the case where
niter is a multiple of VF.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

[Bug target/80634] strangely missed vectorization optimizations

2017-05-05 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80634

--- Comment #3 from Marc Glisse  ---
Did you also try to benchmark it? Last time I checked a similar example, both
versions had similar performance.

[Bug target/80634] strangely missed vectorization optimizations

2017-05-04 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80634

Andrew Pinski  changed:

   What|Removed |Added

  Component|other   |target

--- Comment #2 from Andrew Pinski  ---
So it is doing an alignment check ...

So that would mean it is an issue with the cost model.