This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/46787] New: Does not vectorize loop with load from scalar variable
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 3 Dec 2010 15:27:43 +0000
- Subject: [Bug tree-optimization/46787] New: Does not vectorize loop with load from scalar variable
- Auto-submitted: auto-generated
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.