public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu
@ 2013-08-23  7:56 su at cs dot ucdavis.edu
  2013-08-23  8:06 ` [Bug tree-optimization/58228] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: su at cs dot ucdavis.edu @ 2013-08-23  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58228
           Summary: wrong code (with vectorization?) at -O3 on
                    x86_64-linux-gnu
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The current gcc trunk, as well as gcc 4.7 and 4.8, produces wrong code for the
following testcase on x86_64-linux when compiled at -O3 in both 32-bit and
64-bit modes. This is a regression from 4.6.x.

This seems to do with vectorization, as it goes away with -fno-tree-vectorize. 

$ gcc-trunk -v
gcc version 4.9.0 20130822 (experimental) [trunk revision 201915] (GCC) 
$ gcc-4.6 -O3 reduced.c
$ a.out
1
$ gcc-4.7 -O3 reduced.c
$ a.out
0
$ gcc-4.8 -O3 reduced.c
$ a.out
0
$ gcc-trunk -O3 reduced.c
$ a.out
0
$ gcc-trunk -O3 -fno-tree-vectorize reduced.c
$ a.out
1
$ 


--------------------------------------------


int printf (const char *, ...);

int a[8][8] = {{1}};
int b, c, d, e;

int main ()
{
  for (c = 0; c < 8; c++)
    for (b = 0; b < 2; b++)
      a[b + 4][c] = a[c][0];
  printf ("%d\n", a[4][4]);
  return 0;
}


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

* [Bug tree-optimization/58228] [4.7/4.8/4.9 Regression] wrong code (with vectorization?) at -O3 on x86_64-linux-gnu
  2013-08-23  7:56 [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
@ 2013-08-23  8:06 ` mpolacek at gcc dot gnu.org
  2013-08-23  9:28 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-08-23  8:06 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-08-23
                 CC|                            |mpolacek at gcc dot gnu.org
      Known to work|                            |4.6.3
            Summary|wrong code (with            |[4.7/4.8/4.9 Regression]
                   |vectorization?) at -O3 on   |wrong code (with
                   |x86_64-linux-gnu            |vectorization?) at -O3 on
                   |                            |x86_64-linux-gnu
     Ever confirmed|0                           |1
      Known to fail|                            |4.7.3, 4.8.1, 4.9.0

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.


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

* [Bug tree-optimization/58228] [4.7/4.8/4.9 Regression] wrong code (with vectorization?) at -O3 on x86_64-linux-gnu
  2013-08-23  7:56 [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
  2013-08-23  8:06 ` [Bug tree-optimization/58228] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
@ 2013-08-23  9:28 ` jakub at gcc dot gnu.org
  2013-08-28 20:52 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-08-23  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |4.7.4

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r175704 .


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

* [Bug tree-optimization/58228] [4.7/4.8/4.9 Regression] wrong code (with vectorization?) at -O3 on x86_64-linux-gnu
  2013-08-23  7:56 [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
  2013-08-23  8:06 ` [Bug tree-optimization/58228] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
  2013-08-23  9:28 ` jakub at gcc dot gnu.org
@ 2013-08-28 20:52 ` jakub at gcc dot gnu.org
  2013-08-29 11:01 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-08-28 20:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is nested vectorization, where the step in the inner loop is 0, while in
the outer loop is bigger than that, and for inv_p we look at the step in the
outer loop in that case, while we perhaps should look at the inner one. 
Richard?


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

* [Bug tree-optimization/58228] [4.7/4.8/4.9 Regression] wrong code (with vectorization?) at -O3 on x86_64-linux-gnu
  2013-08-23  7:56 [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (2 preceding siblings ...)
  2013-08-28 20:52 ` jakub at gcc dot gnu.org
@ 2013-08-29 11:01 ` rguenth at gcc dot gnu.org
  2013-08-30  7:49 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-08-29 11:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.


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

* [Bug tree-optimization/58228] [4.7/4.8/4.9 Regression] wrong code (with vectorization?) at -O3 on x86_64-linux-gnu
  2013-08-23  7:56 [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (3 preceding siblings ...)
  2013-08-29 11:01 ` rguenth at gcc dot gnu.org
@ 2013-08-30  7:49 ` rguenth at gcc dot gnu.org
  2013-08-30  7:53 ` [Bug tree-optimization/58228] [4.7/4.8 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-08-30  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Aug 30 07:49:54 2013
New Revision: 202097

URL: http://gcc.gnu.org/viewcvs?rev=202097&root=gcc&view=rev
Log:
2013-08-30  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/58228
    * tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not
    allow invariant loads in nested loop vectorization.

    * gcc.dg/torture/pr58228.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr58228.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-data-refs.c


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

* [Bug tree-optimization/58228] [4.7/4.8 Regression] wrong code (with vectorization?) at -O3 on x86_64-linux-gnu
  2013-08-23  7:56 [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (4 preceding siblings ...)
  2013-08-30  7:49 ` rguenth at gcc dot gnu.org
@ 2013-08-30  7:53 ` rguenth at gcc dot gnu.org
  2013-09-03 12:16 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-08-30  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
      Known to work|                            |4.9.0
            Summary|[4.7/4.8/4.9 Regression]    |[4.7/4.8 Regression] wrong
                   |wrong code (with            |code (with vectorization?)
                   |vectorization?) at -O3 on   |at -O3 on x86_64-linux-gnu
                   |x86_64-linux-gnu            |
      Known to fail|4.9.0                       |

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.


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

* [Bug tree-optimization/58228] [4.7/4.8 Regression] wrong code (with vectorization?) at -O3 on x86_64-linux-gnu
  2013-08-23  7:56 [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (5 preceding siblings ...)
  2013-08-30  7:53 ` [Bug tree-optimization/58228] [4.7/4.8 " rguenth at gcc dot gnu.org
@ 2013-09-03 12:16 ` rguenth at gcc dot gnu.org
  2014-05-23  9:46 ` [Bug tree-optimization/58228] [4.7 " rguenth at gcc dot gnu.org
  2014-05-23  9:46 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-09-03 12:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Sep  3 12:16:28 2013
New Revision: 202216

URL: http://gcc.gnu.org/viewcvs?rev=202216&root=gcc&view=rev
Log:
2013-09-03  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2013-08-30  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/58228
    * tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not
    allow invariant loads in nested loop vectorization.

    * gcc.dg/torture/pr58228.c: New testcase.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr58228.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-vect-data-refs.c


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

* [Bug tree-optimization/58228] [4.7 Regression] wrong code (with vectorization?) at -O3 on x86_64-linux-gnu
  2013-08-23  7:56 [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (6 preceding siblings ...)
  2013-09-03 12:16 ` rguenth at gcc dot gnu.org
@ 2014-05-23  9:46 ` rguenth at gcc dot gnu.org
  2014-05-23  9:46 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-23  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri May 23 09:46:18 2014
New Revision: 210847

URL: http://gcc.gnu.org/viewcvs?rev=210847&root=gcc&view=rev
Log:
2014-05-23  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2013-08-30  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/58228
    * tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not
    allow invariant loads in nested loop vectorization.

    * gcc.dg/torture/pr58228.c: New testcase.

    2013-09-26  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/58539
    * tree-vect-loop.c (vect_create_epilog_for_reduction): Honor
    the fact that debug statements are not taking part in loop-closed
    SSA construction.

    * gcc.dg/torture/pr58539.c: New testcase.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr58228.c
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr58539.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/tree-vect-data-refs.c
    branches/gcc-4_7-branch/gcc/tree-vect-loop.c


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

* [Bug tree-optimization/58228] [4.7 Regression] wrong code (with vectorization?) at -O3 on x86_64-linux-gnu
  2013-08-23  7:56 [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (7 preceding siblings ...)
  2014-05-23  9:46 ` [Bug tree-optimization/58228] [4.7 " rguenth at gcc dot gnu.org
@ 2014-05-23  9:46 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-23  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2014-05-23  9:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23  7:56 [Bug tree-optimization/58228] New: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
2013-08-23  8:06 ` [Bug tree-optimization/58228] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
2013-08-23  9:28 ` jakub at gcc dot gnu.org
2013-08-28 20:52 ` jakub at gcc dot gnu.org
2013-08-29 11:01 ` rguenth at gcc dot gnu.org
2013-08-30  7:49 ` rguenth at gcc dot gnu.org
2013-08-30  7:53 ` [Bug tree-optimization/58228] [4.7/4.8 " rguenth at gcc dot gnu.org
2013-09-03 12:16 ` rguenth at gcc dot gnu.org
2014-05-23  9:46 ` [Bug tree-optimization/58228] [4.7 " rguenth at gcc dot gnu.org
2014-05-23  9:46 ` rguenth 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).