public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/34195]  New: missed optimization with store motion (vectorizer)
@ 2007-11-22 15:30 eres at il dot ibm dot com
  2007-11-22 16:02 ` [Bug tree-optimization/34195] " rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: eres at il dot ibm dot com @ 2007-11-22 15:30 UTC (permalink / raw)
  To: gcc-bugs

The following loop does not get vectorized 
on powerpc64-linux, r130275, GCC 4.3.0:

#define M 10

struct S
{
  float x;
  float y;
} pS[100];

float a[1000];
float b[1000];

void
foo (int n)
{
  int i, j;

  for (i = 0; i < n; i++)
    {
      pS[i].x = 0;
      pS[i].y = 0;

      for (j = 0; j < M; j++)
        {
          pS[i].x += (a[i]+b[i]);
          pS[i].y += (a[i]-b[i]);
        }
    }
}

Here is a snippet from the vectorizer dump file:

u3.c:17: note: dependence distance modulo vf == 0 between pS[i_37].x and
pS[i_37].x
u3.c:17: note: dependence distance  = 0.
u3.c:17: note: accesses have the same alignment.
u3.c:17: note: dependence distance modulo vf == 0 between pS[i_37].y and
pS[i_37].y
u3.c:17: note: === vect_analyze_data_ref_accesses ===
u3.c:17: note: Detected interleaving of size 2
u3.c:17: note: not vectorized: complicated access pattern.
u3.c:17: note: bad data access.(get_loop_exit_condition

...

        base_address: &pS
        offset from base address: (<unnamed-signed:32>) ((unsigned int) i_37 *
8)
        constant offset from base address: 0
        step: 0
        aligned to: 8
        base_object: pS[0].x
        symbol tag: pS
        FAILED as dr address is invariant

u3.c:22: note: not vectorized: unhandled data-ref
u3.c:22: note: bad data references.
u3.c:14: note: vectorized 0 loops in function.

[Zdenek's patch which extends lim can help to do store motion and thus help to
the vectorizer - http://gcc.gnu.org/ml/gcc-patches/2007-01/msg02331.html, but
AFAICT it is not applicable to current mainline)]


-- 
           Summary: missed optimization with store motion (vectorizer)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eres at il dot ibm dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34195


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

* [Bug tree-optimization/34195] missed optimization with store motion (vectorizer)
  2007-11-22 15:30 [Bug tree-optimization/34195] New: missed optimization with store motion (vectorizer) eres at il dot ibm dot com
@ 2007-11-22 16:02 ` rguenth at gcc dot gnu dot org
  2007-11-25 11:21 ` eres at il dot ibm dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-22 16:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-11-22 16:01 -------
Actually the refined patch at
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg02550.html should be more
up-to-date.

Still the idea of an alias oracle needs to be done elsewhere.  We'll be working
on it.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34195


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

* [Bug tree-optimization/34195] missed optimization with store motion (vectorizer)
  2007-11-22 15:30 [Bug tree-optimization/34195] New: missed optimization with store motion (vectorizer) eres at il dot ibm dot com
  2007-11-22 16:02 ` [Bug tree-optimization/34195] " rguenth at gcc dot gnu dot org
@ 2007-11-25 11:21 ` eres at il dot ibm dot com
  2007-11-30 13:41 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: eres at il dot ibm dot com @ 2007-11-25 11:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from eres at il dot ibm dot com  2007-11-25 11:21 -------
I have been testing Zdenek's initial lim patch on SPEC2006 and tramp3d but saw
no effect on the preformance.  We had an example which is similar to the
testcase shown in (http://gcc.gnu.org/ml/gcc-patches/2007-03/txt00067.txt)
which boosted the performance x1.5 due to the store motion (it also opened
opportunity for the vectorizer).  On the other hand; this patch may increased
register pressure.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34195


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

* [Bug tree-optimization/34195] missed optimization with store motion (vectorizer)
  2007-11-22 15:30 [Bug tree-optimization/34195] New: missed optimization with store motion (vectorizer) eres at il dot ibm dot com
  2007-11-22 16:02 ` [Bug tree-optimization/34195] " rguenth at gcc dot gnu dot org
  2007-11-25 11:21 ` eres at il dot ibm dot com
@ 2007-11-30 13:41 ` rguenth at gcc dot gnu dot org
  2007-11-30 13:47 ` rguenth at gcc dot gnu dot org
  2007-11-30 17:24 ` eres at il dot ibm dot com
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-30 13:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2007-11-30 13:41 -------
Created an attachment (id=14673)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14673&action=view)
updated patch

I have updated Zdeneks patch for using an alias oracle for store motion and
loop invariant motion to mainline.  Of the store-motion cases in the testcase
there fail two, test4 and test5.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34195


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

* [Bug tree-optimization/34195] missed optimization with store motion (vectorizer)
  2007-11-22 15:30 [Bug tree-optimization/34195] New: missed optimization with store motion (vectorizer) eres at il dot ibm dot com
                   ` (2 preceding siblings ...)
  2007-11-30 13:41 ` rguenth at gcc dot gnu dot org
@ 2007-11-30 13:47 ` rguenth at gcc dot gnu dot org
  2007-11-30 17:24 ` eres at il dot ibm dot com
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-30 13:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2007-11-30 13:46 -------
That moves the stores

          pS[i].x += (a[i]+b[i]);
          pS[i].y += (a[i]-b[i]);

out of the inner loop, but still none of the loops are vectorized (on x86_64).


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2007-11-30 13:46:49
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34195


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

* [Bug tree-optimization/34195] missed optimization with store motion (vectorizer)
  2007-11-22 15:30 [Bug tree-optimization/34195] New: missed optimization with store motion (vectorizer) eres at il dot ibm dot com
                   ` (3 preceding siblings ...)
  2007-11-30 13:47 ` rguenth at gcc dot gnu dot org
@ 2007-11-30 17:24 ` eres at il dot ibm dot com
  4 siblings, 0 replies; 6+ messages in thread
From: eres at il dot ibm dot com @ 2007-11-30 17:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from eres at il dot ibm dot com  2007-11-30 17:24 -------
(In reply to comment #4)
> That moves the stores
>           pS[i].x += (a[i]+b[i]);
>           pS[i].y += (a[i]-b[i]);
> out of the inner loop, but still none of the loops are vectorized (on x86_64).

Also on ppc64.  It seems to be the same problem as PR32824. Nevertheless lim
can improved performance regardless of vectorization, as was mentioned before.

Taken from the vectorizer dump:
u.c:17: note: vect_is_simple_use: operand pS_I__ypS_I_I_lsm.16_15
u.c:17: note: def_stmt: pS_I__ypS_I_I_lsm.16_15 = PHI
<pS_I__ypS_I_I_lsm.16_23(6), pS_I__ypS_I_I_lsm.16_12(4)>
u.c:17: note: Unsupported pattern.
u.c:17: note: not vectorized: unsupported use in stmt.
u.c:17: note: unexpected pattern.(get_loop_exit_condition


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34195


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

end of thread, other threads:[~2007-11-30 17:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-22 15:30 [Bug tree-optimization/34195] New: missed optimization with store motion (vectorizer) eres at il dot ibm dot com
2007-11-22 16:02 ` [Bug tree-optimization/34195] " rguenth at gcc dot gnu dot org
2007-11-25 11:21 ` eres at il dot ibm dot com
2007-11-30 13:41 ` rguenth at gcc dot gnu dot org
2007-11-30 13:47 ` rguenth at gcc dot gnu dot org
2007-11-30 17:24 ` eres at il dot ibm dot com

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