public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dorit at il dot ibm dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/17165] pass by reference inhibits vectorization
Date: Sun, 07 Nov 2004 14:50:00 -0000	[thread overview]
Message-ID: <20041107145021.12217.qmail@sourceware.org> (raw)
In-Reply-To: <20040824085313.17165.stefaandr@hotmail.com>


------- 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


  parent reply	other threads:[~2004-11-07 14:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-24  8:53 [Bug tree-optimization/17165] New: [lno] " 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041107145021.12217.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).