public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
@ 2011-05-20 19:08 arthur.j.odwyer at gmail dot com
  2011-05-21  9:54 ` [Bug tree-optimization/49093] [4.6/4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2011-05-20 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ICE in vect_enhance_data_refs_alignment() with
                    volatile inside peeled loop
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: arthur.j.odwyer@gmail.com


Created attachment 24311
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24311
Output of "ajo-gcc -std=c99 -w -O1 -funswitch-loops -ftree-vectorize
-fno-tree-fre test.c -v"

This reproduces for me with svn revision 173843 (2011-05-17). It doesn't
reproduce with gcc 4.5.1. I'm on Ubuntu 10.10, x86-64.

cat >test.c <<EOF
volatile unsigned char g_324[4] = {0, 1, 0, 1};
int x, y;
void func_81()
{
    int l_466, l_439[7] = {0};
lbl_473:
    if (x) {
        for (int g_97 = 0; (g_97 < 4); ++g_97) {
            if (y)
              goto lbl_473;
            g_324[g_97];
            l_466 = l_439[g_97];
        }
        foo(l_466);
    }
}
EOF
gcc -std=c99 -w -O1 -funswitch-loops -ftree-vectorize -fno-tree-fre test.c

test.c: In function ‘func_81’:
test.c:3:6: internal compiler error: in vect_enhance_data_refs_alignment, at
tree-vect-data-refs.c:1551



This test case is reduced from the output of Csmith 2.1.0 (git hash 01aa8b04,
https://github.com/Quuxplusone/csmith/), using the following command line:
csmith --no-paranoid --no-longlong --no-pointers --arrays --jumps --consts
--volatiles --no-checksum --no-divs --no-muls --no-bitfields --packed-struct -s
799267216


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
@ 2011-05-21  9:54 ` rguenth at gcc dot gnu.org
  2011-05-21 16:53 ` hjl.tools at gmail dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-21  9:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.21 09:40:47
   Target Milestone|---                         |4.6.1
            Summary|ICE in                      |[4.6/4.7 Regression] ICE in
                   |vect_enhance_data_refs_alig |vect_enhance_data_refs_alig
                   |nment() with volatile       |nment() with volatile
                   |inside peeled loop          |inside peeled loop
     Ever Confirmed|0                           |1
      Known to fail|                            |4.6.0

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-21 09:40:47 UTC ---
Confirmed.


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
  2011-05-21  9:54 ` [Bug tree-optimization/49093] [4.6/4.7 Regression] " rguenth at gcc dot gnu.org
@ 2011-05-21 16:53 ` hjl.tools at gmail dot com
  2011-05-31  7:42 ` irar at il dot ibm.com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2011-05-21 16:53 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2011-05-21 14:44:23 UTC ---
It is caused by revision 166244:

http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00130.html


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
  2011-05-21  9:54 ` [Bug tree-optimization/49093] [4.6/4.7 Regression] " rguenth at gcc dot gnu.org
  2011-05-21 16:53 ` hjl.tools at gmail dot com
@ 2011-05-31  7:42 ` irar at il dot ibm.com
  2011-05-31  8:31 ` rguenther at suse dot de
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: irar at il dot ibm.com @ 2011-05-31  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at il dot ibm.com

--- Comment #3 from Ira Rosen <irar at il dot ibm.com> 2011-05-31 07:31:02 UTC ---
The problem here is that
vol.2_8 ={v} g_324[g_97_22];
is skipped during determination of the vectorization factor, because it has no
uses. The vf is set to 4, and then the analysis fails on the char data-ref.

I think we should just not vectorize when there is a volatile access in a loop.
Is that reasonable?

Thanks,
Ira


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
                   ` (2 preceding siblings ...)
  2011-05-31  7:42 ` irar at il dot ibm.com
@ 2011-05-31  8:31 ` rguenther at suse dot de
  2011-05-31  8:36 ` irar at il dot ibm.com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenther at suse dot de @ 2011-05-31  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> 2011-05-31 08:22:51 UTC ---
On Tue, 31 May 2011, irar at il dot ibm.com wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49093
> 
> Ira Rosen <irar at il dot ibm.com> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |irar at il dot ibm.com
> 
> --- Comment #3 from Ira Rosen <irar at il dot ibm.com> 2011-05-31 07:31:02 UTC ---
> The problem here is that
> vol.2_8 ={v} g_324[g_97_22];
> is skipped during determination of the vectorization factor, because it has no
> uses. The vf is set to 4, and then the analysis fails on the char data-ref.
> 
> I think we should just not vectorize when there is a volatile access in a loop.
> Is that reasonable?

I think that's reasonable for 4.6.  But we don't need to make
data-ref analysis fail just because of volatile references - we for
example can easily unroll a loop with volatile loads/stores.

Of course this case seems to be special - how do we deal with
stmts with no uses during vectorization?  Or do we assume
they don't happen because usually DCE gets rid of them?

Richard.


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
                   ` (3 preceding siblings ...)
  2011-05-31  8:31 ` rguenther at suse dot de
@ 2011-05-31  8:36 ` irar at il dot ibm.com
  2011-05-31  8:54 ` rguenther at suse dot de
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: irar at il dot ibm.com @ 2011-05-31  8:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Ira Rosen <irar at il dot ibm.com> 2011-05-31 08:30:49 UTC ---
(In reply to comment #4)

> I think that's reasonable for 4.6.  But we don't need to make
> data-ref analysis fail just because of volatile references - we for
> example can easily unroll a loop with volatile loads/stores.
> 
> Of course this case seems to be special - how do we deal with
> stmts with no uses during vectorization?  Or do we assume
> they don't happen because usually DCE gets rid of them?

We ignore them. But this is under the assumption that they don't have memory
accesses.

Ira

> 
> Richard.


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
                   ` (4 preceding siblings ...)
  2011-05-31  8:36 ` irar at il dot ibm.com
@ 2011-05-31  8:54 ` rguenther at suse dot de
  2011-05-31  9:10 ` irar at il dot ibm.com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenther at suse dot de @ 2011-05-31  8:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> 2011-05-31 08:43:39 UTC ---
On Tue, 31 May 2011, irar at il dot ibm.com wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49093
> 
> --- Comment #5 from Ira Rosen <irar at il dot ibm.com> 2011-05-31 08:30:49 UTC ---
> (In reply to comment #4)
> 
> > I think that's reasonable for 4.6.  But we don't need to make
> > data-ref analysis fail just because of volatile references - we for
> > example can easily unroll a loop with volatile loads/stores.
> > 
> > Of course this case seems to be special - how do we deal with
> > stmts with no uses during vectorization?  Or do we assume
> > they don't happen because usually DCE gets rid of them?
> 
> We ignore them. But this is under the assumption that they don't have memory
> accesses.

Ah, I see.  Yes, I guess not vectorizing for volatiles is the way
to go then.

Richard.


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
                   ` (5 preceding siblings ...)
  2011-05-31  8:54 ` rguenther at suse dot de
@ 2011-05-31  9:10 ` irar at il dot ibm.com
  2011-05-31  9:18 ` rguenther at suse dot de
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: irar at il dot ibm.com @ 2011-05-31  9:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Ira Rosen <irar at il dot ibm.com> 2011-05-31 09:06:04 UTC ---
I am testing this patch then:

Index: tree-vect-data-refs.c
===================================================================
--- tree-vect-data-refs.c       (revision 174467)
+++ tree-vect-data-refs.c       (working copy)
@@ -2584,6 +2584,16 @@ vect_analyze_data_refs (loop_vec_info lo
             return false;
         }

+      if (TYPE_VOLATILE (TREE_TYPE (DR_REF (dr))))
+        {
+          if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+            {
+              fprintf (vect_dump, "not vectorized: volatile type ");
+              print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+            }
+          return false;
+        }
+
       base = unshare_expr (DR_BASE_ADDRESS (dr));
       offset = unshare_expr (DR_OFFSET (dr));
       init = unshare_expr (DR_INIT (dr));


Thanks,
Ira


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
                   ` (6 preceding siblings ...)
  2011-05-31  9:10 ` irar at il dot ibm.com
@ 2011-05-31  9:18 ` rguenther at suse dot de
  2011-05-31  9:24 ` irar at il dot ibm.com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenther at suse dot de @ 2011-05-31  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> 2011-05-31 09:09:37 UTC ---
On Tue, 31 May 2011, irar at il dot ibm.com wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49093
> 
> --- Comment #7 from Ira Rosen <irar at il dot ibm.com> 2011-05-31 09:06:04 UTC ---
> I am testing this patch then:
> 
> Index: tree-vect-data-refs.c
> ===================================================================
> --- tree-vect-data-refs.c       (revision 174467)
> +++ tree-vect-data-refs.c       (working copy)
> @@ -2584,6 +2584,16 @@ vect_analyze_data_refs (loop_vec_info lo
>              return false;
>          }
> 
> +      if (TYPE_VOLATILE (TREE_TYPE (DR_REF (dr))))

 if (TREE_THIS_VOLATILE (DR_REF (dr)))

instead.

Richard.


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
                   ` (7 preceding siblings ...)
  2011-05-31  9:18 ` rguenther at suse dot de
@ 2011-05-31  9:24 ` irar at il dot ibm.com
  2011-05-31 12:46 ` irar at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: irar at il dot ibm.com @ 2011-05-31  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Ira Rosen <irar at il dot ibm.com> 2011-05-31 09:17:26 UTC ---
(In reply to comment #8)

> > 
> > +      if (TYPE_VOLATILE (TREE_TYPE (DR_REF (dr))))
> 
>  if (TREE_THIS_VOLATILE (DR_REF (dr)))
> 
> instead.
>

OK. Thanks.
Ira

> Richard.


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
                   ` (8 preceding siblings ...)
  2011-05-31  9:24 ` irar at il dot ibm.com
@ 2011-05-31 12:46 ` irar at gcc dot gnu.org
  2011-06-02  7:03 ` irar at gcc dot gnu.org
  2011-06-02  7:12 ` irar at il dot ibm.com
  11 siblings, 0 replies; 13+ messages in thread
From: irar at gcc dot gnu.org @ 2011-05-31 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from irar at gcc dot gnu.org 2011-05-31 12:31:09 UTC ---
Author: irar
Date: Tue May 31 12:31:04 2011
New Revision: 174477

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

        PR tree-optimization/49093
        * tree-vect-data-refs.c (vect_analyze_data_refs): Fail for
        volatile data references.


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


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
                   ` (9 preceding siblings ...)
  2011-05-31 12:46 ` irar at gcc dot gnu.org
@ 2011-06-02  7:03 ` irar at gcc dot gnu.org
  2011-06-02  7:12 ` irar at il dot ibm.com
  11 siblings, 0 replies; 13+ messages in thread
From: irar at gcc dot gnu.org @ 2011-06-02  7:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from irar at gcc dot gnu.org 2011-06-02 07:03:04 UTC ---
Author: irar
Date: Thu Jun  2 07:02:57 2011
New Revision: 174559

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

        PR tree-optimization/49093
        * tree-vect-data-refs.c (vect_analyze_data_refs): Fail for
        volatile data references.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/vect/pr49093.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_6-branch/gcc/tree-vect-data-refs.c


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

* [Bug tree-optimization/49093] [4.6/4.7 Regression] ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop
  2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
                   ` (10 preceding siblings ...)
  2011-06-02  7:03 ` irar at gcc dot gnu.org
@ 2011-06-02  7:12 ` irar at il dot ibm.com
  11 siblings, 0 replies; 13+ messages in thread
From: irar at il dot ibm.com @ 2011-06-02  7:12 UTC (permalink / raw)
  To: gcc-bugs

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

Ira Rosen <irar at il dot ibm.com> changed:

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

--- Comment #12 from Ira Rosen <irar at il dot ibm.com> 2011-06-02 07:11:29 UTC ---
Fixed.


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

end of thread, other threads:[~2011-06-02  7:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-20 19:08 [Bug tree-optimization/49093] New: ICE in vect_enhance_data_refs_alignment() with volatile inside peeled loop arthur.j.odwyer at gmail dot com
2011-05-21  9:54 ` [Bug tree-optimization/49093] [4.6/4.7 Regression] " rguenth at gcc dot gnu.org
2011-05-21 16:53 ` hjl.tools at gmail dot com
2011-05-31  7:42 ` irar at il dot ibm.com
2011-05-31  8:31 ` rguenther at suse dot de
2011-05-31  8:36 ` irar at il dot ibm.com
2011-05-31  8:54 ` rguenther at suse dot de
2011-05-31  9:10 ` irar at il dot ibm.com
2011-05-31  9:18 ` rguenther at suse dot de
2011-05-31  9:24 ` irar at il dot ibm.com
2011-05-31 12:46 ` irar at gcc dot gnu.org
2011-06-02  7:03 ` irar at gcc dot gnu.org
2011-06-02  7:12 ` irar at il dot ibm.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).