public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/66718] New: Non-invariant ADDR_EXPR not vectorized
@ 2015-07-01  9:41 jakub at gcc dot gnu.org
  2015-07-01  9:46 ` [Bug tree-optimization/66718] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-07-01  9:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66718

            Bug ID: 66718
           Summary: Non-invariant ADDR_EXPR not vectorized
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: mpolacek at gcc dot gnu.org, rguenth at gcc dot gnu.org
  Target Milestone: ---

E.g. on:
int *a[1024], b[1024];
struct S { int u, v, w, x; };
struct S c[1024];

void
f0 (void)
{
  for (int i = 0; i < 1024; i++)
    a[i] = &b[0];
}

void
f1 (void)
{
  for (int i = 0; i < 1024; i++)
    {
      int *p = &b[0];
      a[i] = p + i;
    }
}

void
f2 (int *p)
{
  for (int i = 0; i < 1024; i++)
    a[i] = &p[i];
}

void
f3 (void)
{
  for (int i = 0; i < 1024; i++)
    a[i] = &b[i];
}

void
f4 (void)
{
  int *p = &c[0].v;
  for (int i = 0; i < 1024; i++)
    a[i] = &p[4 * i];
}

void
f5 (void)
{
  for (int i = 0; i < 1024; i++)
    a[i] = &c[i].v;
}

with -O3 -mavx2 we vectorize only the loops where the address computation has
been lowered (f1, f2, f4) or is address of invariant (f0), but the vectorizer
is not able to vectorize ADDR_EXPR of non-invariant.

Richard thinks this would be best solved by lowering such ADDR_EXPR
assignments,
somewhere in between the last objsz pass and pre, maybe even before reassoc so
that it can optimize even that.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-07-09 21:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-01  9:41 [Bug tree-optimization/66718] New: Non-invariant ADDR_EXPR not vectorized jakub at gcc dot gnu.org
2015-07-01  9:46 ` [Bug tree-optimization/66718] " rguenth at gcc dot gnu.org
2015-07-01 15:15 ` mpolacek at gcc dot gnu.org
2015-07-05 12:12 ` jakub at gcc dot gnu.org
2015-07-05 12:15 ` jakub at gcc dot gnu.org
2015-07-09  9:02 ` mpolacek at gcc dot gnu.org
2015-07-09  9:06 ` mpolacek at gcc dot gnu.org
2015-07-09 21:12 ` jakub 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).