This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/17165] pass by reference inhibits vectorization
- From: "dorit at il dot ibm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Nov 2004 14:50:21 -0000
- Subject: [Bug tree-optimization/17165] pass by reference inhibits vectorization
- References: <20040824085313.17165.stefaandr@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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