public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/56933] [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses
       [not found] <bug-56933-4@http.gcc.gnu.org/bugzilla/>
@ 2013-04-15 10:29 ` rguenth at gcc dot gnu.org
  2013-04-15 11:18 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-15 10:29 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-04-15
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.9.0
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-15 10:29:19 UTC ---
Mine.


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

* [Bug tree-optimization/56933] [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses
       [not found] <bug-56933-4@http.gcc.gnu.org/bugzilla/>
  2013-04-15 10:29 ` [Bug tree-optimization/56933] [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses rguenth at gcc dot gnu.org
@ 2013-04-15 11:18 ` rguenth at gcc dot gnu.org
  2013-04-15 14:09 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-15 11:18 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-15 11:18:43 UTC ---
/* { dg-do run } */

extern void abort (void);
void __attribute__((noinline,noclone))
foo (double *b, double *d, double *f)
{
  int i;
  for (i = 0; i < 1024; i++)
    {
      d[2*i] = 2. * d[2*i];
      d[2*i+1] = 4. * d[2*i+1];
      b[i] = d[2*i] - 1.;
      f[i] = d[2*i+1] + 2.;
    }
}
int main()
{
  double b[1024], d[2*1024], f[1024];
  int i;
  for (i = 0; i < 2*1024; i++)
    d[i] = 1.;
  foo (b, d, f);
  for (i = 0; i < 1024; i+= 2)
    {
      if (d[2*i] != 2.)
        abort ();
      if (d[2*i+1] != 4.)
        abort ();
    }
  for (i = 0; i < 1024; i++)
    {
      if (b[i] != 1.)
        abort ();
      if (f[i] != 6.)
        abort ();
    }
  return 0;
}

/* { dg-final { cleanup-tree-dump "vect" } } */


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

* [Bug tree-optimization/56933] [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses
       [not found] <bug-56933-4@http.gcc.gnu.org/bugzilla/>
  2013-04-15 10:29 ` [Bug tree-optimization/56933] [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses rguenth at gcc dot gnu.org
  2013-04-15 11:18 ` rguenth at gcc dot gnu.org
@ 2013-04-15 14:09 ` rguenth at gcc dot gnu.org
  2013-08-27 17:03 ` bernd.edlinger at hotmail dot de
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-15 14:09 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-15 14:09:14 UTC ---
Author: rguenth
Date: Mon Apr 15 14:08:41 2013
New Revision: 197972

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

    PR tree-optimization/56933
    * tree-vectorizer.h (struct _stmt_vec_info): Remove read_write_dep
    member.
    (GROUP_READ_WRITE_DEPENDENCE): Remove.
    (STMT_VINFO_GROUP_READ_WRITE_DEPENDENCE): Likewise.
    * tree-vect-data-refs.c (vect_analyze_group_access): Move
    dependence check ...
    vect_analyze_data_ref_dependence (vect_analyze_data_ref_dependence):
    ... here.
    * tree-vect-stmts.c (new_stmt_vec_info): Do not initialize
    GROUP_READ_WRITE_DEPENDENCE.

    * gcc.dg/vect/pr56933.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr56933.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-data-refs.c
    trunk/gcc/tree-vect-stmts.c
    trunk/gcc/tree-vectorizer.h


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

* [Bug tree-optimization/56933] [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses
       [not found] <bug-56933-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-04-15 14:09 ` rguenth at gcc dot gnu.org
@ 2013-08-27 17:03 ` bernd.edlinger at hotmail dot de
  2013-08-27 17:17 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2013-08-27 17:03 UTC (permalink / raw)
  To: gcc-bugs

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

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernd.edlinger at hotmail dot de

--- Comment #4 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
The test case gcc.dg/vect/pr56933.c fails on a pentium II,
because of invalid instruction.

A fairly obvious fix (which works for me) would be:

--- gcc/testsuite/gcc.dg/vect/pr56933.c.jj      2013-04-15 16:08:41.000000000
+0200
+++ gcc/testsuite/gcc.dg/vect/pr56933.c 2013-08-22 21:12:19.000000000 +0200
@@ -1,4 +1,5 @@
 /* { dg-do run } */
+/* { dg-require-effective-target sse2_runtime } */

 extern void abort (void);
 void __attribute__((noinline,noclone))


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

* [Bug tree-optimization/56933] [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses
       [not found] <bug-56933-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2013-08-27 17:03 ` bernd.edlinger at hotmail dot de
@ 2013-08-27 17:17 ` jakub at gcc dot gnu.org
  2013-08-28 15:10 ` bernd.edlinger at hotmail dot de
  2013-08-29  7:31 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-08-27 17:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Bernd Edlinger from comment #4)
> The test case gcc.dg/vect/pr56933.c fails on a pentium II,
> because of invalid instruction.
> 
> A fairly obvious fix (which works for me) would be:

There is nothing obvious on it (maybe obviously broken).
The vect.exp tests aren't i?86/x86_64 only, so you definitely can't add
unguarded requirements for specific CPUs, it would cause the test not to be run
on ppcs/arm/etc.

The bug in this test is that it specifies { dg-do run }, either it shouldn't
(then the default will be run if CPU supports the -msse2 flags in this case, or
compile otherwise), or it should use the tree-vect.h + check_vect () framework
like many other tests.

> --- gcc/testsuite/gcc.dg/vect/pr56933.c.jj      2013-04-15
> 16:08:41.000000000 +0200
> +++ gcc/testsuite/gcc.dg/vect/pr56933.c 2013-08-22 21:12:19.000000000 +0200
> @@ -1,4 +1,5 @@
>  /* { dg-do run } */
> +/* { dg-require-effective-target sse2_runtime } */
> 
>  extern void abort (void);
>  void __attribute__((noinline,noclone))


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

* [Bug tree-optimization/56933] [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses
       [not found] <bug-56933-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2013-08-27 17:17 ` jakub at gcc dot gnu.org
@ 2013-08-28 15:10 ` bernd.edlinger at hotmail dot de
  2013-08-29  7:31 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2013-08-28 15:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Created attachment 30712
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30712&action=edit
fixed test case

Looking deeper into the matter it seems like this an example
where vectorisation is not supposed to happen.
But this is still vectorized and causes the crash here:

   for (i = 0; i < 2*1024; i++)
     d[i] = 1.;


So this is my proposed fix for the test case:
- added check_vect() to prevent invalid instruction as Jakub suggested
- addeded scan-tree-dump to detect the READ_WRITE depencency
  to make sure that the vectorization in foo() did not happen
  for the right reason.


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

* [Bug tree-optimization/56933] [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses
       [not found] <bug-56933-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2013-08-28 15:10 ` bernd.edlinger at hotmail dot de
@ 2013-08-29  7:31 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-08-29  7:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Bernd Edlinger from comment #7)
> Created attachment 30712 [details]
> fixed test case
> 
> Looking deeper into the matter it seems like this an example
> where vectorisation is not supposed to happen.
> But this is still vectorized and causes the crash here:
> 
>    for (i = 0; i < 2*1024; i++)
>      d[i] = 1.;

That loop is initialization only and can be vectorized.  I have committed
a fix (hopefully), so you may want to check again.

> 
> So this is my proposed fix for the test case:
> - added check_vect() to prevent invalid instruction as Jakub suggested
> - addeded scan-tree-dump to detect the READ_WRITE depencency
>   to make sure that the vectorization in foo() did not happen
>   for the right reason.


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

end of thread, other threads:[~2013-08-29  7:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-56933-4@http.gcc.gnu.org/bugzilla/>
2013-04-15 10:29 ` [Bug tree-optimization/56933] [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses rguenth at gcc dot gnu.org
2013-04-15 11:18 ` rguenth at gcc dot gnu.org
2013-04-15 14:09 ` rguenth at gcc dot gnu.org
2013-08-27 17:03 ` bernd.edlinger at hotmail dot de
2013-08-27 17:17 ` jakub at gcc dot gnu.org
2013-08-28 15:10 ` bernd.edlinger at hotmail dot de
2013-08-29  7:31 ` 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).