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/46787] New: Does not vectorize loop with load from scalar variable


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46787

           Summary: Does not vectorize loop with load from scalar variable
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org
                CC: irar@gcc.gnu.org


When looking at why GCC is so slow with the himeno benchmark in the usual
Phoronix testing I noticed that we do not vectorize

float *x;
float parm;
float
test (int start, int end)
{
  int i;
  for (i = start; i < end; ++i)
    {
      float tem = x[i];
      x[i] = parm * tem;
    }
}

because there is a scalar non-varying load of parm that, when the loop
rolls just a single time is aliased by the store to x[i].

We are though vectorizing with at least a vectorization factor of two,
which means that x cannot validly point to parm (and a vector store
would exceed the scalar variables size, something that after vectorization
alias-analysis would use to disambiguate the vector store and the load).

Thus we can treat loads of scalar decls as if they were done outside of
the loop and vectorize it as

     D.1234_3 = tem;
     vec_tmp_4 = { D.1234_3, D.1234_3 };

thus, as if D.1234_3 were a vect_external_def and mark the statement
itself as not relevant.


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