public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/32824]  New: Missed reduction vectorizer after store to global is LIM'd
@ 2007-07-19 16:56 pinskia at gcc dot gnu dot org
  2007-07-19 18:09 ` [Bug tree-optimization/32824] " dorit at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-07-19 16:56 UTC (permalink / raw)
  To: gcc-bugs

Testcase:
int a[16*100];
int e;
float f(void)
{
  int i;
  for(i = 0;i<16*100;i++)
    e += a[i];
}
rt.c:7: note: not vectorized: unsupported use in stmt.

If I manually LIM'd e, then this is vectorized.


-- 
           Summary: Missed reduction vectorizer after store to global is
                    LIM'd
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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


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

* [Bug tree-optimization/32824] Missed reduction vectorizer after store to global is LIM'd
  2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
@ 2007-07-19 18:09 ` dorit at gcc dot gnu dot org
  2007-07-19 18:14 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dorit at gcc dot gnu dot org @ 2007-07-19 18:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dorit at gcc dot gnu dot org  2007-07-19 18:09 -------
I think this is similar to PR19347?


-- 


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


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

* [Bug tree-optimization/32824] Missed reduction vectorizer after store to global is LIM'd
  2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
  2007-07-19 18:09 ` [Bug tree-optimization/32824] " dorit at gcc dot gnu dot org
@ 2007-07-19 18:14 ` pinskia at gcc dot gnu dot org
  2007-07-19 18:28 ` dorit at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-07-19 18:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-07-19 18:14 -------
(In reply to comment #1)
> I think this is similar to PR19347?
It is not because LIM does its work, IR right before the vectorizer:
<bb 3>:
  # ivtmp.31_17 = PHI <ivtmp.31_18(4), 1600(2)>
  # e_lsm.30_1 = PHI <e_lsm.30_13(4), e_lsm.30_8(2)>
  # i_14 = PHI <i_7(4), 0(2)>
  D.2248_4 = a[i_14];
  e.1_5 = e_lsm.30_1;
  e.2_6 = D.2248_4 + e.1_5;
  e_lsm.30_13 = e.2_6;
  i_7 = i_14 + 1;
  ivtmp.31_18 = ivtmp.31_17 - 1;
  if (ivtmp.31_18 != 0)

There are no loads from e in the loop.


-- 


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


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

* [Bug tree-optimization/32824] Missed reduction vectorizer after store to global is LIM'd
  2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
  2007-07-19 18:09 ` [Bug tree-optimization/32824] " dorit at gcc dot gnu dot org
  2007-07-19 18:14 ` pinskia at gcc dot gnu dot org
@ 2007-07-19 18:28 ` dorit at gcc dot gnu dot org
  2007-07-24  8:59 ` dorit at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dorit at gcc dot gnu dot org @ 2007-07-19 18:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dorit at gcc dot gnu dot org  2007-07-19 18:28 -------
ah, I misunderstood you - when you wrote before that you manually LIM'd e I
assumed it was because LIM didn't work. I see that the problem is with the
"garbage" that LIM leaves behind:

pr32824.c:6: note: Analyze phi: e_lsm.30_1 = PHI <e_lsm.30_13(4),
e_lsm.30_8(2)pr32824.c:6: note: Unknown def-use cycle pattern.
...
pr32824.c:6: note: def_stmt: e_lsm.30_1 = PHI <e_lsm.30_13(4), e_lsm.30_8(2)>
pr32824.c:6: note: Unsupported pattern.
pr32824.c:6: note: not vectorized: unsupported use in stmt.

We may have a PR for cleaning up redundant phis (or teach the vectorizer to
ignore them) - I'll try to look for it.


-- 


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


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

* [Bug tree-optimization/32824] Missed reduction vectorizer after store to global is LIM'd
  2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-07-19 18:28 ` dorit at gcc dot gnu dot org
@ 2007-07-24  8:59 ` dorit at gcc dot gnu dot org
  2007-08-14 20:48 ` dorit at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dorit at gcc dot gnu dot org @ 2007-07-24  8:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dorit at gcc dot gnu dot org  2007-07-24 08:59 -------
Just for the record - as we discussed last week, there are two ways to solve
this problem - either have LIM leave behind it cleaner code (smthing like
copy-prop + dce to eliminate the extra copy stmts), or improve the reduction
detection code in the vectorizer, which is something we want to do anyway.
Actually this looks like a duplicate of PR25621.


-- 


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


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

* [Bug tree-optimization/32824] Missed reduction vectorizer after store to global is LIM'd
  2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-07-24  8:59 ` dorit at gcc dot gnu dot org
@ 2007-08-14 20:48 ` dorit at gcc dot gnu dot org
  2010-02-26 13:21 ` manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dorit at gcc dot gnu dot org @ 2007-08-14 20:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dorit at gcc dot gnu dot org  2007-08-14 20:47 -------
Additional testcases:

(1) see  loop in lines 23 and 32 in 
http://gcc.gnu.org/ml/gcc-help/2007-08/msg00171.html

(2)
>       SUBROUTINE SUSCEP(L,Iz)
>       IMPLICIT NONE
>       INTEGER L , Iz(L,L) , iznum, ix, iy
>       iznum = 0
>       DO ix = 1 , L
>          DO iy = 1 , L
>             iznum = iznum + Iz(iy,ix)
>          ENDDO
>       ENDDO
>       PRINT* iznum
>       END subroutine
>       end
> 

The above is a slightly modified testcase taken from Polyhedron test suite
(ac.f90).
We get:
b.f90:6: note: Analyze phi: iznum_lsm.74_31 = PHI <iznum_lsm.74_32(4),
iznum_lsm.74_12(6)>
b.f90:6: note: reduction: not commutative/associative: iznum.10_37
tobias2b.f90:6: note: Unknown def-use cycle pattern.
...
b.f90:6: note: worklist: examine stmt: iznum.9_36 = iznum_lsm.74_31
b.f90:6: note: vect_is_simple_use: operand iznum_lsm.74_31
b.f90:6: note: def_stmt: iznum_lsm.74_31 = PHI <iznum_lsm.74_32(4),
iznum_lsm.74_12(6)>
b.f90:6: note: Unsupported pattern.
b.f90:6: note: not vectorized: unsupported use in stmt.
2b.f90:6: note: unexpected pattern.

This happens because we get the following pattern:
  # iznum_lsm.74_31 = PHI <iznum_lsm.74_32(4), iznum_lsm.74_12(6)>
  ...
  iznum.9_36 = iznum_lsm.74_31;
  iznum.10_37 = D.1420_35 + iznum.9_36;
  iznum_lsm.74_12 = iznum.10_37;
  ...


-- 


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


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

* [Bug tree-optimization/32824] Missed reduction vectorizer after store to global is LIM'd
  2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-08-14 20:48 ` dorit at gcc dot gnu dot org
@ 2010-02-26 13:21 ` manu at gcc dot gnu dot org
  2010-03-17 17:59 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-26 13:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from manu at gcc dot gnu dot org  2010-02-26 13:20 -------
*** Bug 43184 has been marked as a duplicate of this bug. ***


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |changpeng dot fang at amd
                   |                            |dot com


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


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

* [Bug tree-optimization/32824] Missed reduction vectorizer after store to global is LIM'd
  2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-02-26 13:21 ` manu at gcc dot gnu dot org
@ 2010-03-17 17:59 ` burnus at gcc dot gnu dot org
  2010-03-17 21:22 ` changpeng dot fang at amd dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-03-17 17:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2010-03-17 17:58 -------
Patch by Changpeng, which has been approved for 4.6 Stage 1 and moves the
"pass_lim" up;
http://gcc.gnu.org/ml/gcc-patches/2010-03/msg00775.html


-- 


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


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

* [Bug tree-optimization/32824] Missed reduction vectorizer after store to global is LIM'd
  2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-03-17 17:59 ` burnus at gcc dot gnu dot org
@ 2010-03-17 21:22 ` changpeng dot fang at amd dot com
  2010-04-06 19:20 ` spop at gcc dot gnu dot org
  2010-04-11  5:45 ` spop at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-03-17 21:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from changpeng dot fang at amd dot com  2010-03-17 21:22 -------
Created an attachment (id=20133)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20133&action=view)
patch with the testcase


-- 


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


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

* [Bug tree-optimization/32824] Missed reduction vectorizer after store to global is LIM'd
  2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2010-03-17 21:22 ` changpeng dot fang at amd dot com
@ 2010-04-06 19:20 ` spop at gcc dot gnu dot org
  2010-04-11  5:45 ` spop at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-04-06 19:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from spop at gcc dot gnu dot org  2010-04-06 19:20 -------
Subject: Bug 32824

Author: spop
Date: Tue Apr  6 19:19:41 2010
New Revision: 158018

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158018
Log:
Fix PR32824.

2010-04-06  Changpeng Fang  <changpeng.fang@amd.com>

        PR middle-end/32824
        * passes.c (init_optimization_passes): Move pass_lim before
        pass_copy_prop and pass_dce_loop.

        * gcc.dg/vect/pr32824: New.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr32824.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/passes.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug tree-optimization/32824] Missed reduction vectorizer after store to global is LIM'd
  2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2010-04-06 19:20 ` spop at gcc dot gnu dot org
@ 2010-04-11  5:45 ` spop at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-04-11  5:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from spop at gcc dot gnu dot org  2010-04-11 05:45 -------
Fixed.


-- 

spop at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-04-11  5:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-19 16:56 [Bug tree-optimization/32824] New: Missed reduction vectorizer after store to global is LIM'd pinskia at gcc dot gnu dot org
2007-07-19 18:09 ` [Bug tree-optimization/32824] " dorit at gcc dot gnu dot org
2007-07-19 18:14 ` pinskia at gcc dot gnu dot org
2007-07-19 18:28 ` dorit at gcc dot gnu dot org
2007-07-24  8:59 ` dorit at gcc dot gnu dot org
2007-08-14 20:48 ` dorit at gcc dot gnu dot org
2010-02-26 13:21 ` manu at gcc dot gnu dot org
2010-03-17 17:59 ` burnus at gcc dot gnu dot org
2010-03-17 21:22 ` changpeng dot fang at amd dot com
2010-04-06 19:20 ` spop at gcc dot gnu dot org
2010-04-11  5:45 ` spop at gcc dot gnu dot 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).