public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/46787] New: Does not vectorize loop with load from scalar variable
@ 2010-12-03 15:27 rguenth at gcc dot gnu.org
2010-12-03 15:37 ` [Bug tree-optimization/46787] " rguenth at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-03 15:27 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/46787] Does not vectorize loop with load from scalar variable
2010-12-03 15:27 [Bug tree-optimization/46787] New: Does not vectorize loop with load from scalar variable rguenth at gcc dot gnu.org
@ 2010-12-03 15:37 ` rguenth at gcc dot gnu.org
2011-04-21 14:40 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-03 15:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46787
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-03 15:37:16 UTC ---
To fix:
/* FIXME -- data dependence analysis does not work correctly for objects
with invariant addresses in loop nests. Let us fail here until the
problem is fixed. */
if (dr_address_invariant_p (dr) && nest)
{
free_data_ref (dr);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\tFAILED as dr address is invariant\n");
ret = false;
break;
}
for this to work and be a real improvement we need to pass down the
minimum iterations of the loop (thus, the minimum vectorization factor
in case of the vectorizer).
We can also fix it up locally in the vectorizer when
compute_data_dependences_for_loop would not re-scan the loop
for data references (but we'd do it in the vectorizer and remove
the scalar loads).
We can also avoid computing data dependences until
vect_analyze_data_ref_dependences then and save some compile-time for
non-vectorized loops.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/46787] Does not vectorize loop with load from scalar variable
2010-12-03 15:27 [Bug tree-optimization/46787] New: Does not vectorize loop with load from scalar variable rguenth at gcc dot gnu.org
2010-12-03 15:37 ` [Bug tree-optimization/46787] " rguenth at gcc dot gnu.org
@ 2011-04-21 14:40 ` rguenth at gcc dot gnu.org
2011-06-30 13:28 ` rguenth at gcc dot gnu.org
2011-06-30 13:28 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-21 14:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46787
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011.04.21 14:39:11
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-21 14:39:11 UTC ---
Mine.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/46787] Does not vectorize loop with load from scalar variable
2010-12-03 15:27 [Bug tree-optimization/46787] New: Does not vectorize loop with load from scalar variable rguenth at gcc dot gnu.org
` (2 preceding siblings ...)
2011-06-30 13:28 ` rguenth at gcc dot gnu.org
@ 2011-06-30 13:28 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-30 13:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46787
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.7.0
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-30 13:28:06 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/46787] Does not vectorize loop with load from scalar variable
2010-12-03 15:27 [Bug tree-optimization/46787] New: Does not vectorize loop with load from scalar variable rguenth at gcc dot gnu.org
2010-12-03 15:37 ` [Bug tree-optimization/46787] " rguenth at gcc dot gnu.org
2011-04-21 14:40 ` rguenth at gcc dot gnu.org
@ 2011-06-30 13:28 ` rguenth at gcc dot gnu.org
2011-06-30 13:28 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-30 13:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46787
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-30 13:27:47 UTC ---
Author: rguenth
Date: Thu Jun 30 13:27:43 2011
New Revision: 175704
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175704
Log:
2011-06-30 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46787
* tree-data-ref.c (dr_address_invariant_p): Remove.
(find_data_references_in_stmt): Invariant accesses are ok now.
* tree-vect-stmts.c (vectorizable_load): Handle invariant
loads.
* tree-vect-data-refs.c (vect_analyze_data_ref_access): Allow
invariant loads.
* gcc.dg/vect/vect-121.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.dg/vect/vect-121.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-data-ref.c
trunk/gcc/tree-vect-data-refs.c
trunk/gcc/tree-vect-stmts.c
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-30 13:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-03 15:27 [Bug tree-optimization/46787] New: Does not vectorize loop with load from scalar variable rguenth at gcc dot gnu.org
2010-12-03 15:37 ` [Bug tree-optimization/46787] " rguenth at gcc dot gnu.org
2011-04-21 14:40 ` rguenth at gcc dot gnu.org
2011-06-30 13:28 ` rguenth at gcc dot gnu.org
2011-06-30 13:28 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).