public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/43182] New: gcc could not vectorize this simple loop (un-handled data-ref)
@ 2010-02-25 23:37 changpeng dot fang at amd dot com
2010-02-25 23:45 ` [Bug middle-end/43182] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-02-25 23:37 UTC (permalink / raw)
To: gcc-bugs
gcc 4.5 can not vectorize this simple loop:
void foo(int a[], int n) {
int i;
for(i=1; i< n; i++)
a[i] = a[0];
}
"gcc -O3 -fdump-tree-vect-all -c foo.c" shows:
foo.c:3: note: not vectorized: unhandled data-ref
foo.c:3: note: bad data references.
foo.c:1: note: vectorized 0 loops in function.
It seems gcc gets confused at a[0] and gives up vectorization. There
is no dependence in this loop, and we should teach gcc to handle a[0]
to vectorize it.
--
Summary: gcc could not vectorize this simple loop (un-handled
data-ref)
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: changpeng dot fang at amd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43182
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/43182] gcc could not vectorize this simple loop (un-handled data-ref)
2010-02-25 23:37 [Bug middle-end/43182] New: gcc could not vectorize this simple loop (un-handled data-ref) changpeng dot fang at amd dot com
@ 2010-02-25 23:45 ` pinskia at gcc dot gnu dot org
2010-02-25 23:50 ` [Bug middle-end/43182] GCC does not pull out a[0] from loop that changes a[i] for i:[1,n] pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-02-25 23:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2010-02-25 23:45 -------
Actually a[0] should be load hoisted from the loop as it not changed from
inside the loop at all.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |alias, missed-optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43182
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/43182] GCC does not pull out a[0] from loop that changes a[i] for i:[1,n]
2010-02-25 23:37 [Bug middle-end/43182] New: gcc could not vectorize this simple loop (un-handled data-ref) changpeng dot fang at amd dot com
2010-02-25 23:45 ` [Bug middle-end/43182] " pinskia at gcc dot gnu dot org
@ 2010-02-25 23:50 ` pinskia at gcc dot gnu dot org
2010-02-25 23:54 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-02-25 23:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2010-02-25 23:50 -------
So currently inside LIM (which does load motion in general):
D.2724_7 = a_6(D) + D.2723_5;
D.2725_8 = *a_6(D);
*D.2724_7 = D.2725_8;
But LIM/alias oracle does not know that D.2723_5 has a range of [4, n_3*4]
which means D.2724_7 can never equal a_6 so we don't pull out the load from
a_6.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-02-25 23:50:10
date| |
Summary|gcc could not vectorize this|GCC does not pull out a[0]
|simple loop (un-handled |from loop that changes a[i]
|data-ref) |for i:[1,n]
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43182
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/43182] GCC does not pull out a[0] from loop that changes a[i] for i:[1,n]
2010-02-25 23:37 [Bug middle-end/43182] New: gcc could not vectorize this simple loop (un-handled data-ref) changpeng dot fang at amd dot com
2010-02-25 23:45 ` [Bug middle-end/43182] " pinskia at gcc dot gnu dot org
2010-02-25 23:50 ` [Bug middle-end/43182] GCC does not pull out a[0] from loop that changes a[i] for i:[1,n] pinskia at gcc dot gnu dot org
@ 2010-02-25 23:54 ` pinskia at gcc dot gnu dot org
2010-02-26 18:53 ` changpeng dot fang at amd dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-02-25 23:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2010-02-25 23:54 -------
Related to PR 29751 but that only does a simple method and does not handle this
case as we need range info.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43182
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/43182] GCC does not pull out a[0] from loop that changes a[i] for i:[1,n]
2010-02-25 23:37 [Bug middle-end/43182] New: gcc could not vectorize this simple loop (un-handled data-ref) changpeng dot fang at amd dot com
` (2 preceding siblings ...)
2010-02-25 23:54 ` pinskia at gcc dot gnu dot org
@ 2010-02-26 18:53 ` changpeng dot fang at amd dot com
2010-02-26 18:55 ` pinskia at gcc dot gnu dot org
2010-02-26 19:06 ` changpeng dot fang at amd dot com
5 siblings, 0 replies; 8+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-02-26 18:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from changpeng dot fang at amd dot com 2010-02-26 18:53 -------
Here is another similar case but more general. We know that a(j) and a(i)
never access the same memory location. intel ifort can vectorize this
triangular
loop:
do 10 j = 1,n
do 20 i = j+1, n
a(i) = a(i) - aa(i,j) * a(j)
20 continue
10 continue
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43182
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/43182] GCC does not pull out a[0] from loop that changes a[i] for i:[1,n]
2010-02-25 23:37 [Bug middle-end/43182] New: gcc could not vectorize this simple loop (un-handled data-ref) changpeng dot fang at amd dot com
` (3 preceding siblings ...)
2010-02-26 18:53 ` changpeng dot fang at amd dot com
@ 2010-02-26 18:55 ` pinskia at gcc dot gnu dot org
2010-02-26 19:06 ` changpeng dot fang at amd dot com
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-02-26 18:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2010-02-26 18:55 -------
(In reply to comment #4)
> Here is another similar case but more general.
Actually it is a totally different case. Please file a new bug with that case;
though there might already be a bug about that one.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43182
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/43182] GCC does not pull out a[0] from loop that changes a[i] for i:[1,n]
2010-02-25 23:37 [Bug middle-end/43182] New: gcc could not vectorize this simple loop (un-handled data-ref) changpeng dot fang at amd dot com
` (4 preceding siblings ...)
2010-02-26 18:55 ` pinskia at gcc dot gnu dot org
@ 2010-02-26 19:06 ` changpeng dot fang at amd dot com
5 siblings, 0 replies; 8+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-02-26 19:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from changpeng dot fang at amd dot com 2010-02-26 19:06 -------
>
> Actually it is a totally different case. Please file a new bug with that case;
> though there might already be a bug about that one.
>
I could not see the difference even though j is not a compile-time constant.
(it
is an invariant to the innermost loop). I can say:
GCC does not pull out a[j] from loop that changes a[i] for i:[j+1,n]
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43182
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <bug-43182-4@http.gcc.gnu.org/bugzilla/>]
end of thread, other threads:[~2021-07-26 7:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-25 23:37 [Bug middle-end/43182] New: gcc could not vectorize this simple loop (un-handled data-ref) changpeng dot fang at amd dot com
2010-02-25 23:45 ` [Bug middle-end/43182] " pinskia at gcc dot gnu dot org
2010-02-25 23:50 ` [Bug middle-end/43182] GCC does not pull out a[0] from loop that changes a[i] for i:[1,n] pinskia at gcc dot gnu dot org
2010-02-25 23:54 ` pinskia at gcc dot gnu dot org
2010-02-26 18:53 ` changpeng dot fang at amd dot com
2010-02-26 18:55 ` pinskia at gcc dot gnu dot org
2010-02-26 19:06 ` changpeng dot fang at amd dot com
[not found] <bug-43182-4@http.gcc.gnu.org/bugzilla/>
2021-07-26 7:45 ` pinskia 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).