public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization
@ 2004-08-24 8:53 stefaandr at hotmail dot com
2004-08-24 15:14 ` [Bug tree-optimization/17165] " pinskia at gcc dot gnu dot org
` (10 more replies)
0 siblings, 11 replies; 13+ messages in thread
From: stefaandr at hotmail dot com @ 2004-08-24 8:53 UTC (permalink / raw)
To: gcc-bugs
The following code doesn't get vectorized:
typedef int T; T a[4], c[4];
T & input(int x) { return a[x]; };
T & result(int x) { return c[x]; };
int main() {
for (int x=0; x<4; ++x)
result(x) = input(x);
};
which is just c[x] = a[x], but with wrapper functions.
It gives:
Access function of ptr: {(T &)&a, +, 4}_1
loop at test23.cpp:4: not vectorized: non constant init/step for pointer access.
loop at test23.cpp:4: bad data references.
The step is constant, so I guess &a is considered "non-constant". And why does
it say &a (incorrect in my opinion), instead of &a[0]?
Reading specs from
/esat/olympia/install/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa-lno/specs
Configured with: /esat/alexandria1/stefaan/src/gcc/lno/configure
--prefix=/esat/olympia/install --program-suffix=-lno --enable-languages=c,c++ :
(reconfigured) /esat/alexandria1/stefaan/src/gcc/lno/configure
--prefix=/esat/olympia/install --program-suffix=-lno
--with-gcc-version-trigger=/esat/alexandria1/stefaan/src/gcc/lno/gcc/version.c
--enable-languages=c,c++ --no-create --no-recursion : (reconfigured)
/esat/alexandria1/stefaan/src/gcc/lno/configure --prefix=/esat/olympia/install
--program-suffix=-lno
--with-gcc-version-trigger=/esat/alexandria1/stefaan/src/gcc/lno/gcc/version.c
--enable-languages=c,c++ --no-create --no-recursion
Thread model: posix
gcc version 3.5-tree-ssa-lno 20040824 (merged 20040718)
/esat/olympia/install/libexec/gcc/i686-pc-linux-gnu/3.5-tree-ssa-lno/cc1plus
-quiet -v -D_GNU_SOURCE test23.cpp -quiet -dumpbase test23.cpp -march=pentium4
-auxbase-strip test23.o -O9 -version -ftree-vectorize -fdump-tree-vect-stats
-fdump-tree-vect-details -funroll-all-loops -finline-limit=1000000
-finline-functions -o /tmp/ccsL4r8X.s
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/esat/olympia/install/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa-lno/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/esat/olympia/install/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa-lno/../../../../include/c++/3.5-tree-ssa-lno
/esat/olympia/install/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa-lno/../../../../include/c++/3.5-tree-ssa-lno/i686-pc-linux-gnu
/esat/olympia/install/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa-lno/../../../../include/c++/3.5-tree-ssa-lno/backward
/esat/olympia/install/include
/esat/olympia/install/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa-lno/include
/usr/include
End of search list.
GNU C++ version 3.5-tree-ssa-lno 20040824 (merged 20040718) (i686-pc-linux-gnu)
compiled by GNU C version 3.4.1.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
as -V -Qy -o test23.o /tmp/ccsL4r8X.s
GNU assembler version 2.15 (i686-pc-linux-gnu) using BFD version 2.15
--
Summary: [lno] pass by reference inhibits vectorization
Product: gcc
Version: lno
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stefaandr at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
@ 2004-08-24 15:14 ` pinskia at gcc dot gnu dot org
2004-08-31 23:43 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 15:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-24 15:14 -------
Confirmed on the mainline (since the vectorizer was merged):
Access function of ptr: {(T &)&a, +, 4}_1
step: 4, init: (T &)&a
loop at pr17165.cc:4: not vectorized: non constant init/step for pointer access.
loop at pr17165.cc:4: bad data references.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|minor |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2004-08-24 15:14:45
date| |
Summary|[lno] pass by reference |pass by reference inhibits
|inhibits vectorization |vectorization
Version|lno |3.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
2004-08-24 15:14 ` [Bug tree-optimization/17165] " pinskia at gcc dot gnu dot org
@ 2004-08-31 23:43 ` pinskia at gcc dot gnu dot org
2004-09-01 0:47 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-31 23:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-31 23:43 -------
Well now the problem is slightly difference:
Access function of ptr: T.5_11
loop at pr17165.cc:4: not vectorized: pointer access is not simple.
loop at pr17165.cc:4: bad data references.
T.4_7 = &c[x_26];
T.5_11 = &a[x_26];
T.6_13 = *T.5_11;
*T.4_7 = T.6_13;
And this would be related to PR 14814 and some other PRs too.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |14814
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
2004-08-24 15:14 ` [Bug tree-optimization/17165] " pinskia at gcc dot gnu dot org
2004-08-31 23:43 ` pinskia at gcc dot gnu dot org
@ 2004-09-01 0:47 ` pinskia at gcc dot gnu dot org
2004-09-03 9:34 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-01 0:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-01 00:47 -------
Here is another example without inlining and references which show that this problem is really the
same as the problem in PR 14814:
typedef int T; T a[4], c[4];
int main() {
for (int x=0; x<4; ++x)
{
T *i = &a[x];
T *r = &c[x];
*r = *i;
}
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
` (2 preceding siblings ...)
2004-09-01 0:47 ` pinskia at gcc dot gnu dot org
@ 2004-09-03 9:34 ` pinskia at gcc dot gnu dot org
2004-09-11 1:31 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-03 9:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-03 09:34 -------
Mine, I have a patch/working on getting this fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
` (3 preceding siblings ...)
2004-09-03 9:34 ` pinskia at gcc dot gnu dot org
@ 2004-09-11 1:31 ` pinskia at gcc dot gnu dot org
2004-09-15 4:47 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-11 1:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-11 01:30 -------
Basically fold should convert (T<D1029> *) (x.0<D1040>_5 * 4) + &a<D1030> into
&a<D1030>[x.0<D1040>_5] and then we can do the C case but the C++ case is easier and gets done
when I finish up my tree combiner see 15459.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |15459
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
` (4 preceding siblings ...)
2004-09-11 1:31 ` pinskia at gcc dot gnu dot org
@ 2004-09-15 4:47 ` pinskia at gcc dot gnu dot org
2004-09-15 4:55 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-15 4:47 UTC (permalink / raw)
To: gcc-bugs
--
Bug 17165 depends on bug 14814, which changed state.
Bug 14814 Summary: no folding back to ARRAY_REF
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14814
What |Old Value |New Value
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
` (5 preceding siblings ...)
2004-09-15 4:47 ` pinskia at gcc dot gnu dot org
@ 2004-09-15 4:55 ` pinskia at gcc dot gnu dot org
2004-11-07 14:50 ` dorit at il dot ibm dot com
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-15 4:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-15 04:55 -------
While 14814 is fixed, this one is no.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
` (6 preceding siblings ...)
2004-09-15 4:55 ` pinskia at gcc dot gnu dot org
@ 2004-11-07 14:50 ` dorit at il dot ibm dot com
2005-05-17 18:10 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: dorit at il dot ibm dot com @ 2004-11-07 14:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dorit at il dot ibm dot com 2004-11-07 14:50 -------
(1) The first (original) testcase does not get vectorized because
analyze_scalar_evolution is unable to analyze the access-function of the
pointers in the loop. For the pointer D.1780_5 it returns "D.1780_5" instead
of "(c,+,4B)_1" (and similarly for D.1781_9: we have "D.1781_9", we
want "(a,+,4B)_1"):
Access function of ptr: D.1781_9
loop at pr17165.cc:17: not vectorized: pointer access is not simple.
loop at pr17165.cc:17: not vectorized: unhandled data ref: D.1782_11 = *D.1781_9
loop at pr17165.cc:17: bad data references.
Don't know if we can expect analyze_scalar_evolution to return a meaningful
access_function when the code is represented this way:
# ivtmp.7_22 = PHI <4(0), ivtmp.7_10(3)>;
# x_24 = PHI <0(0), x_12(3)>;
<L0>:;
D.1780_5 = &c[x_24];
D.1781_9 = &a[x_24];
D.1782_11 = *D.1781_9;
*D.1780_5 = D.1782_11;
x_12 = x_24 + 1;
ivtmp.7_10 = ivtmp.7_22 - 1;
if (ivtmp.7_10 != 0) goto <L7>; else goto <L4>;
I don't see which of the tree combiner PRs listed in PR15459 would help us
here. ?
(2) The second testcase does not get vectorized because the alias information
tells the vectorizer that the pointers 'r' and 'i' may alias:
loop at pr17165.c:6: not vectorized: can't determine dependence between: *i_6
and *r_10
This loop will be vectorized once we have runtime alias/dependence testing in
the vectorizer, or when points-to analysis is able to tell that 'a' and 'c'
don't alias:
# ivtmp.2_9 = PHI <4(0), ivtmp.2_8(3)>;
# c_22 = PHI <c_15(0), c_18(3)>;
# a_23 = PHI <a_16(0), a_17(3)>;
# x_24 = PHI <0(0), x_12(3)>;
<L0>:;
x.0_3 = (unsigned int) x_24;
D.1328_4 = x.0_3 * 4;
D.1329_5 = (T *) D.1328_4;
i_6 = D.1329_5 + &a;
r_10 = D.1329_5 + &c;
# VUSE <a_23>;
# VUSE <c_22>;
D.1330_11 = *i_6;
# a_17 = V_MAY_DEF <a_23>;
# c_18 = V_MAY_DEF <c_22>;
*r_10 = D.1330_11;
x_12 = x_24 + 1;
ivtmp.2_8 = ivtmp.2_9 - 1;
if (ivtmp.2_8 != 0) goto <L5>; else goto <L2>;
<L5>:;
goto <bb 1> (<L0>);
========> Here's the alias dump:
Referenced variables in main1: 10
Variable: x, UID 0, int
Variable: x.0, UID 1, unsigned int
Variable: D.1328, UID 2, unsigned int
Variable: D.1329, UID 3, T *
Variable: i, UID 4, T *, type memory tag: TMT.1
Variable: a, UID 5, T[3], is an alias tag, is addressable, is global, call
clobbered, default def: a_16
Variable: r, UID 6, T *, type memory tag: TMT.1
Variable: c, UID 7, T[3], is an alias tag, is addressable, is global, call
clobbered, default def: c_15
Variable: D.1330, UID 8, int
Variable: TMT.1, UID 9, T, is addressable, is global, call clobbered, may
aliases: { a c }
Pointed-to sets for pointers in main1
D.1329_5, points-to anything
i_6, is dereferenced, points-to anything, points-to vars: { a }
r_10, is dereferenced, points-to anything, points-to vars: { c }
Flow-insensitive alias information for main1
Aliased symbols
a, UID 5, T[3], is an alias tag, is addressable, is global, call clobbered,
default def: a_16
c, UID 7, T[3], is an alias tag, is addressable, is global, call clobbered,
default def: c_15
TMT.1, UID 9, T, is addressable, is global, call clobbered, may aliases: { a c }
Dereferenced pointers
i, UID 4, T *, type memory tag: TMT.1
r, UID 6, T *, type memory tag: TMT.1
Type memory tags
TMT.1, UID 9, T, is addressable, is global, call clobbered, may aliases: { a c }
Flow-sensitive alias information for main1
SSA_NAME pointers
Name memory tags
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
` (7 preceding siblings ...)
2004-11-07 14:50 ` dorit at il dot ibm dot com
@ 2005-05-17 18:10 ` pinskia at gcc dot gnu dot org
2005-05-18 20:37 ` jsm28 at gcc dot gnu dot org
2005-05-18 20:44 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-17 18:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-17 18:10 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
` (8 preceding siblings ...)
2005-05-17 18:10 ` pinskia at gcc dot gnu dot org
@ 2005-05-18 20:37 ` jsm28 at gcc dot gnu dot org
2005-05-18 20:44 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-05-18 20:37 UTC (permalink / raw)
To: gcc-bugs
--
Bug 17165 depends on bug 14814, which changed state.
Bug 14814 Summary: no folding back to ARRAY_REF
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14814
What |Old Value |New Value
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
` (9 preceding siblings ...)
2005-05-18 20:37 ` jsm28 at gcc dot gnu dot org
@ 2005-05-18 20:44 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-18 20:44 UTC (permalink / raw)
To: gcc-bugs
--
Bug 17165 depends on bug 14814, which changed state.
Bug 14814 Summary: no folding back to ARRAY_REF
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14814
What |Old Value |New Value
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/17165] pass by reference inhibits vectorization
[not found] <bug-17165-4@http.gcc.gnu.org/bugzilla/>
@ 2014-10-31 4:02 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-10-31 4:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17165
Bug 17165 depends on bug 15459, which changed state.
Bug 15459 Summary: [meta-bug] there should be a tree combiner like the rtl one
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15459
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-10-31 4:02 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-24 8:53 [Bug tree-optimization/17165] New: [lno] pass by reference inhibits vectorization stefaandr at hotmail dot com
2004-08-24 15:14 ` [Bug tree-optimization/17165] " pinskia at gcc dot gnu dot org
2004-08-31 23:43 ` pinskia at gcc dot gnu dot org
2004-09-01 0:47 ` pinskia at gcc dot gnu dot org
2004-09-03 9:34 ` pinskia at gcc dot gnu dot org
2004-09-11 1:31 ` pinskia at gcc dot gnu dot org
2004-09-15 4:47 ` pinskia at gcc dot gnu dot org
2004-09-15 4:55 ` pinskia at gcc dot gnu dot org
2004-11-07 14:50 ` dorit at il dot ibm dot com
2005-05-17 18:10 ` pinskia at gcc dot gnu dot org
2005-05-18 20:37 ` jsm28 at gcc dot gnu dot org
2005-05-18 20:44 ` pinskia at gcc dot gnu dot org
[not found] <bug-17165-4@http.gcc.gnu.org/bugzilla/>
2014-10-31 4:02 ` 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).