public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/33804]  New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
@ 2007-10-17 21:11 falk at debian dot org
  2007-10-18  5:26 ` [Bug tree-optimization/33804] " ubizjak at gmail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: falk at debian dot org @ 2007-10-17 21:11 UTC (permalink / raw)
  To: gcc-bugs

falk@juist:/tmp% gcc -c -O2 129.c              
falk@juist:/tmp% gcc -c -O2 -ftree-vectorize 129.c
129.c: In function 'add_bytes_c':
129.c:1: internal compiler error: in vect_transform_stmt, at
tree-vect-transform.c:6131
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


-- 
           Summary: ICE in vect_transform_stmt, at tree-vect-
                    transform.c:6131 with -ftree-vectorize
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: falk at debian dot org
 GCC build triplet: alphaev68-unknown-linux-gnu
  GCC host triplet: alphaev68-unknown-linux-gnu
GCC target triplet: alphaev68-unknown-linux-gnu


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
@ 2007-10-18  5:26 ` ubizjak at gmail dot com
  2007-10-18  6:27 ` falk at debian dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ubizjak at gmail dot com @ 2007-10-18  5:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ubizjak at gmail dot com  2007-10-18 05:26 -------
Testcase?


-- 


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
  2007-10-18  5:26 ` [Bug tree-optimization/33804] " ubizjak at gmail dot com
@ 2007-10-18  6:27 ` falk at debian dot org
  2007-10-18  8:33 ` irar at il dot ibm dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: falk at debian dot org @ 2007-10-18  6:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from falk at debian dot org  2007-10-18 06:27 -------
Whoops.

void f(unsigned char *s, unsigned char *d, int n) {
    int i;
    for (i = 0; i < n; i += 4) {
        d[i + 0] += s[i + 0];
        d[i + 1] += s[i + 1];
        d[i + 2] += s[i + 2];
        d[i + 3] += s[i + 3];
    }
}


-- 


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
  2007-10-18  5:26 ` [Bug tree-optimization/33804] " ubizjak at gmail dot com
  2007-10-18  6:27 ` falk at debian dot org
@ 2007-10-18  8:33 ` irar at il dot ibm dot com
  2007-10-18 19:26 ` falk at debian dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: irar at il dot ibm dot com @ 2007-10-18  8:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from irar at il dot ibm dot com  2007-10-18 08:33 -------
It works fine for me (and the loop gets SLPed) on powerpc-64 and x86_64.

Could you please run it with -fdump-tree-vect-details and attach the dump file?

Ira


-- 


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
                   ` (2 preceding siblings ...)
  2007-10-18  8:33 ` irar at il dot ibm dot com
@ 2007-10-18 19:26 ` falk at debian dot org
  2007-10-21  8:46 ` irar at il dot ibm dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: falk at debian dot org @ 2007-10-18 19:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from falk at debian dot org  2007-10-18 19:26 -------
Created an attachment (id=14370)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14370&action=view)
Vectorization dump file


-- 


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
                   ` (3 preceding siblings ...)
  2007-10-18 19:26 ` falk at debian dot org
@ 2007-10-21  8:46 ` irar at il dot ibm dot com
  2007-10-21 12:53 ` irar at il dot ibm dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: irar at il dot ibm dot com @ 2007-10-21  8:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from irar at il dot ibm dot com  2007-10-21 08:45 -------
(In reply to comment #4)
> Created an attachment (id=14370)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14370&action=view) [edit]
> Vectorization dump file
> 
Thanks!

The vectorizer fails in transformation phase in function
vectorizable_operation:
  if (icode == CODE_FOR_nothing)
    {
      if (vect_print_dump_info (REPORT_DETAILS))
        fprintf (vect_dump, "op not supported by target.");
      if (GET_MODE_SIZE (vec_mode) != UNITS_PER_WORD
          || LOOP_VINFO_VECT_FACTOR (loop_vinfo)
             < vect_min_worthwhile_factor (code))
        return false;
      if (vect_print_dump_info (REPORT_DETAILS))
        fprintf (vect_dump, "proceeding using word mode.");
    }

During the analysis, we also get CODE_FOR_nothing, but also at that stage
LOOP_VINFO_VECT_FACTOR (loop_vinfo) > vect_min_worthwhile_factor (code)
hence we proceed using word mode.
At the end of the analysis, we change the vectorization factor (divide it by 4)
to perform pure SLP on the loop, so during the transformation phase, when we
get to the same code again, we probably get that  
LOOP_VINFO_VECT_FACTOR (loop_vinfo) < vect_min_worthwhile_factor (code)
and we fail.

The idea was that we should not fail to vectorize during the transformation,
since everything was checked during the analysis, therefore, a gcc_assert was
put here.

I'll have to think how to fix this problem.

Thanks,
Ira


-- 


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
                   ` (4 preceding siblings ...)
  2007-10-21  8:46 ` irar at il dot ibm dot com
@ 2007-10-21 12:53 ` irar at il dot ibm dot com
  2007-10-22  6:31 ` irar at il dot ibm dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: irar at il dot ibm dot com @ 2007-10-21 12:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from irar at il dot ibm dot com  2007-10-21 12:52 -------
The solution can be just not check if the vectorization is worthwhile during
the transformation. The decision whether to vectorize or not should be made
during the analysis anyway. 
The vectorization factor can get smaller only in case that there is only
SLP-kind of vectorization in the loop, and the VF is the unrolling factor
needed to operate on full vectors. So the profitability of this loop
vectorization doesn't change.

Index: tree-vect-transform.c
===================================================================
--- tree-vect-transform.c       (revision 129404)
+++ tree-vect-transform.c       (working copy)
@@ -3865,18 +3865,21 @@ vectorizable_operation (tree stmt, block
     {
       if (vect_print_dump_info (REPORT_DETAILS))
        fprintf (vect_dump, "op not supported by target.");
+      /* Check only during analysis.  */
       if (GET_MODE_SIZE (vec_mode) != UNITS_PER_WORD
-          || LOOP_VINFO_VECT_FACTOR (loop_vinfo)
-            < vect_min_worthwhile_factor (code))
+          || (LOOP_VINFO_VECT_FACTOR (loop_vinfo)
+             < vect_min_worthwhile_factor (code)
+              && !vec_stmt))
         return false;
       if (vect_print_dump_info (REPORT_DETAILS))
        fprintf (vect_dump, "proceeding using word mode.");
     }

-  /* Worthwhile without SIMD support?  */
+  /* Worthwhile without SIMD support? Check only during analysis.  */
   if (!VECTOR_MODE_P (TYPE_MODE (vectype))
       && LOOP_VINFO_VECT_FACTOR (loop_vinfo)
-        < vect_min_worthwhile_factor (code))
+        < vect_min_worthwhile_factor (code)
+      && !vec_stmt)
     {
       if (vect_print_dump_info (REPORT_DETAILS))
        fprintf (vect_dump, "not worthwhile without SIMD support.");

Tested on vectorizer testsuite on x86-64-linux.

Ira


-- 


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
                   ` (5 preceding siblings ...)
  2007-10-21 12:53 ` irar at il dot ibm dot com
@ 2007-10-22  6:31 ` irar at il dot ibm dot com
  2007-10-22 13:47 ` falk at debian dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: irar at il dot ibm dot com @ 2007-10-22  6:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from irar at il dot ibm dot com  2007-10-22 06:31 -------
Falk,

Could you please check if the patch in Comment #6 fixes the ICE?

Thanks,
Ira


-- 


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
                   ` (6 preceding siblings ...)
  2007-10-22  6:31 ` irar at il dot ibm dot com
@ 2007-10-22 13:47 ` falk at debian dot org
  2007-10-24  9:35 ` irar at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: falk at debian dot org @ 2007-10-22 13:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from falk at debian dot org  2007-10-22 13:47 -------
(In reply to comment #7)
> Could you please check if the patch in Comment #6 fixes the ICE?

Yes, this fixes it. Thanks!


-- 


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
                   ` (7 preceding siblings ...)
  2007-10-22 13:47 ` falk at debian dot org
@ 2007-10-24  9:35 ` irar at gcc dot gnu dot org
  2007-10-30 10:10 ` irar at il dot ibm dot com
  2007-12-02 23:41 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: irar at gcc dot gnu dot org @ 2007-10-24  9:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from irar at gcc dot gnu dot org  2007-10-24 09:35 -------
Subject: Bug 33804

Author: irar
Date: Wed Oct 24 09:35:00 2007
New Revision: 129599

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129599
Log:
        PR tree-optimization/33804
        * tree-vect-transform.c (vectorizable_operation): Remove the
        checks that the vectorization is worthwhile from the transformation
        phase.


Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr33804.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-transform.c


-- 


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
                   ` (8 preceding siblings ...)
  2007-10-24  9:35 ` irar at gcc dot gnu dot org
@ 2007-10-30 10:10 ` irar at il dot ibm dot com
  2007-12-02 23:41 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: irar at il dot ibm dot com @ 2007-10-30 10:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from irar at il dot ibm dot com  2007-10-30 10:09 -------
Fixed.


-- 

irar at il dot ibm dot com changed:

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


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


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

* [Bug tree-optimization/33804] ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize
  2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
                   ` (9 preceding siblings ...)
  2007-10-30 10:10 ` irar at il dot ibm dot com
@ 2007-12-02 23:41 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-02 23:41 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-12-02 23:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-17 21:11 [Bug tree-optimization/33804] New: ICE in vect_transform_stmt, at tree-vect-transform.c:6131 with -ftree-vectorize falk at debian dot org
2007-10-18  5:26 ` [Bug tree-optimization/33804] " ubizjak at gmail dot com
2007-10-18  6:27 ` falk at debian dot org
2007-10-18  8:33 ` irar at il dot ibm dot com
2007-10-18 19:26 ` falk at debian dot org
2007-10-21  8:46 ` irar at il dot ibm dot com
2007-10-21 12:53 ` irar at il dot ibm dot com
2007-10-22  6:31 ` irar at il dot ibm dot com
2007-10-22 13:47 ` falk at debian dot org
2007-10-24  9:35 ` irar at gcc dot gnu dot org
2007-10-30 10:10 ` irar at il dot ibm dot com
2007-12-02 23:41 ` pinskia 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).