public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/50014] New: [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy
@ 2011-08-07 13:20 d.g.gorbachev at gmail dot com
  2011-08-08 10:05 ` [Bug tree-optimization/50014] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2011-08-07 13:20 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.7 Regression] Assertion failed in
                    vect_get_vec_def_for_stmt_copy
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: d.g.gorbachev@gmail.com
            Target: i686-pc-linux-gnu


Created attachment 24939
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24939
Backtrace

Compile with `-O3 -march=pentium4':

int f(unsigned char *s, int n)
{
  int sum = 0;
  int i;

  for (i = 0; i < n; i++)
    sum += 256 * s[i];

  return sum;
}


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

* [Bug tree-optimization/50014] [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy
  2011-08-07 13:20 [Bug tree-optimization/50014] New: [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy d.g.gorbachev at gmail dot com
@ 2011-08-08 10:05 ` rguenth at gcc dot gnu.org
  2011-08-08 12:28 ` irar at il dot ibm.com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-08-08 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.08.08 10:05:16
                 CC|                            |irar at gcc dot gnu.org
   Target Milestone|---                         |4.7.0
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-08-08 10:05:16 UTC ---
Confirmed on x86_64 with -m32 -msse2.  Looks like caused by the
widening pattern matching code.


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

* [Bug tree-optimization/50014] [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy
  2011-08-07 13:20 [Bug tree-optimization/50014] New: [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy d.g.gorbachev at gmail dot com
  2011-08-08 10:05 ` [Bug tree-optimization/50014] " rguenth at gcc dot gnu.org
@ 2011-08-08 12:28 ` irar at il dot ibm.com
  2011-08-09  6:02 ` irar at gcc dot gnu.org
  2011-08-09 11:08 ` irar at il dot ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: irar at il dot ibm.com @ 2011-08-08 12:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |irar at il dot ibm.com
         AssignedTo|unassigned at gcc dot       |irar at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from Ira Rosen <irar at il dot ibm.com> 2011-08-08 12:27:44 UTC ---
Somehow when getting a copy of a vector operand in reduction we use a dummy
def_type, which causes that we try to make a copy of a constant instead of just
using it. 
I am going to test this patch:

Index: tree-vect-loop.c
===================================================================
--- tree-vect-loop.c    (revision 177423)
+++ tree-vect-loop.c    (working copy)
@@ -4310,7 +4310,7 @@ vectorizable_reduction (gimple stmt, gim
   VEC (tree, heap) *vec_oprnds0 = NULL, *vec_oprnds1 = NULL, *vect_defs =
NULL;
   VEC (gimple, heap) *phis = NULL;
   int vec_num;
-  tree def0, def1, tem;
+  tree def0, def1, tem, op0, op1 = NULL_TREE;

   /* In case of reduction chain we switch to the first stmt in the chain, but
      we don't update STMT_INFO, since only the last stmt is marked as
reduction
@@ -4767,8 +4767,6 @@ vectorizable_reduction (gimple stmt, gim
       /* Handle uses.  */
       if (j == 0)
         {
-          tree op0, op1 = NULL_TREE;
-
           op0 = ops[!reduc_index];
           if (op_type == ternary_op)
             {
@@ -4798,11 +4796,19 @@ vectorizable_reduction (gimple stmt, gim
         {
           if (!slp_node)
             {
-              enum vect_def_type dt = vect_unknown_def_type; /* Dummy */
-              loop_vec_def0 = vect_get_vec_def_for_stmt_copy (dt,
loop_vec_def0);
+              enum vect_def_type dt;
+              gimple dummy_stmt;
+              tree dummy;
+
+              vect_is_simple_use (ops[!reduc_index], loop_vinfo, NULL,
+                                  &dummy_stmt, &dummy, &dt);
+              loop_vec_def0 = vect_get_vec_def_for_stmt_copy (dt,
+                                                              loop_vec_def0);
               VEC_replace (tree, vec_oprnds0, 0, loop_vec_def0);
               if (op_type == ternary_op)
                 {
+                  vect_is_simple_use (op1, loop_vinfo, NULL, &dummy_stmt,
+                                      &dummy, &dt);
                   loop_vec_def1 = vect_get_vec_def_for_stmt_copy (dt,
                                                                
loop_vec_def1);
                   VEC_replace (tree, vec_oprnds1, 0, loop_vec_def1);


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

* [Bug tree-optimization/50014] [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy
  2011-08-07 13:20 [Bug tree-optimization/50014] New: [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy d.g.gorbachev at gmail dot com
  2011-08-08 10:05 ` [Bug tree-optimization/50014] " rguenth at gcc dot gnu.org
  2011-08-08 12:28 ` irar at il dot ibm.com
@ 2011-08-09  6:02 ` irar at gcc dot gnu.org
  2011-08-09 11:08 ` irar at il dot ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: irar at gcc dot gnu.org @ 2011-08-09  6:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from irar at gcc dot gnu.org 2011-08-09 06:02:04 UTC ---
Author: irar
Date: Tue Aug  9 06:02:00 2011
New Revision: 177581

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

        PR tree-optimization/50014
        * tree-vect-loop.c (vectorizable_reduction): Get def type before
        calling vect_get_vec_def_for_stmt_copy ().


Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr50014.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-loop.c


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

* [Bug tree-optimization/50014] [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy
  2011-08-07 13:20 [Bug tree-optimization/50014] New: [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy d.g.gorbachev at gmail dot com
                   ` (2 preceding siblings ...)
  2011-08-09  6:02 ` irar at gcc dot gnu.org
@ 2011-08-09 11:08 ` irar at il dot ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: irar at il dot ibm.com @ 2011-08-09 11:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Ira Rosen <irar at il dot ibm.com> 2011-08-09 11:07:47 UTC ---
Fixed.


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

end of thread, other threads:[~2011-08-09 11:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-07 13:20 [Bug tree-optimization/50014] New: [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy d.g.gorbachev at gmail dot com
2011-08-08 10:05 ` [Bug tree-optimization/50014] " rguenth at gcc dot gnu.org
2011-08-08 12:28 ` irar at il dot ibm.com
2011-08-09  6:02 ` irar at gcc dot gnu.org
2011-08-09 11:08 ` 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).