This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/51848] GCC is not able to vectorize when a constant value is also added to the sum of array expression inside a loop.


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51848

alalaw01 at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alalaw01 at gcc dot gnu.org

--- Comment #5 from alalaw01 at gcc dot gnu.org ---
(In reply to Richard Biener from comment #3)
> (In reply to comment #2)
> > We don't recognize this as reduction because we look for:
> > 
> >      a1 = phi < a0, a2 >
> >      a3 = ...
> >      a2 = operation (a3, a1)
> > 
> > and here we have
> > 
> >      a1 = phi < a0, a2 >
> >      a3 = ...
> >      a4 = operation (a3, a1)
> >      a2 = a4 + 1
> 
> It seems reassociation should "fix" this.  IIRC we had some special code
> in there that was supposed to handle this.

We do reassociate equivalent functions in C, for example

float x[30];

float bar() {
  float s = 0;
  for (int i = 0; i < 30; i++)
    {
      s += x[i];
      s += 1;
    }
  return s;
}

which vectorizes just fine.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]