public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30771]  New: ice for legal code with -O2 -ftree-vectorize
@ 2007-02-12  8:52 dcb314 at hotmail dot com
  2007-02-12  8:53 ` [Bug c++/30771] " dcb314 at hotmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dcb314 at hotmail dot com @ 2007-02-12  8:52 UTC (permalink / raw)
  To: gcc-bugs

I just tried to compile Suse Linux package ladspa-1.12.code10-56
with the GNU C++ compiler version 4.3 snapshot 20070209.

The compiler said

Descriptor.h: In static member function 'static void*
Descriptor<T>::_instantiate(const _LADSPA_Descriptor*, ulong) [with T =
CabinetII]':
Descriptor.h:117: internal compiler error: in vectorizable_type_promotion, at
tree-vect-transform.c:2601
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Preprocessed source code attached. Flags -ftree-vectorize -O2 required.


-- 
           Summary: ice for legal code with -O2 -ftree-vectorize
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dcb314 at hotmail dot com
  GCC host triplet: x86_64-suse-linux


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


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

* [Bug c++/30771] ice for legal code with -O2 -ftree-vectorize
  2007-02-12  8:52 [Bug c++/30771] New: ice for legal code with -O2 -ftree-vectorize dcb314 at hotmail dot com
@ 2007-02-12  8:53 ` dcb314 at hotmail dot com
  2007-02-12  9:58 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dcb314 at hotmail dot com @ 2007-02-12  8:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dcb314 at hotmail dot com  2007-02-12 08:53 -------
Created an attachment (id=13038)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13038&action=view)
C++ source code


-- 


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


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

* [Bug c++/30771] ice for legal code with -O2 -ftree-vectorize
  2007-02-12  8:52 [Bug c++/30771] New: ice for legal code with -O2 -ftree-vectorize dcb314 at hotmail dot com
  2007-02-12  8:53 ` [Bug c++/30771] " dcb314 at hotmail dot com
@ 2007-02-12  9:58 ` rguenth at gcc dot gnu dot org
  2007-02-12 10:11 ` dorit at il dot ibm dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-12  9:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2007-02-12 09:58 -------
Confirmed.  We hit

#1  0x0000000000ecf362 in vectorizable_type_promotion (stmt=0x2afac97cd000, 
    bsi=0x0, vec_stmt=0x0)
    at /space/rguenther/src/svn/trunk/gcc/tree-vect-transform.c:2752
2752      gcc_assert (ncopies >= 1);

because nunits_in is 4 but LOOP_VINFO_VECT_FACTOR (loop_vinfo) is 2. As this is
actually a widening (i_45 is int):

D.6364_12 = (long unsigned int) i_45

This is the loop:

  # SMT.373_48 = PHI <SMT.373_35(5), SMT.373_33(3)>
  # SMT.372_46 = PHI <SMT.372_34(5), SMT.372_32(3)>
  # i_45 = PHI <i_17(5), 0(3)>
<L0>:;
  d.29_10 = pretmp.393_8;
  D.6363_11 = pretmp.394_7;
  D.6364_12 = (long unsigned int) i_45;
  D.6365_13 = D.6364_12 * 12;
  D.6366_14 = (struct LADSPA_PortRangeHint *) D.6365_13;
  D.6367_15 = pretmp.394_7 + D.6366_14;
  D.6368_16 = &D.6367_15->LowerBound;
  # SMT.372_34 = VDEF <SMT.372_46>
  # SMT.373_35 = VDEF <SMT.373_48>
  plugin_3->ports[i_45] = D.6368_16;
  i_17 = i_45 + 1;
  if (i_17 < D.6359_44) goto <L9>; else goto <L2>;

so we are actually trying to vectorize a widening of the induction variable.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dorit at il dot ibm dot com,
                   |                            |rguenth at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/30771] ice for legal code with -O2 -ftree-vectorize
  2007-02-12  8:52 [Bug c++/30771] New: ice for legal code with -O2 -ftree-vectorize dcb314 at hotmail dot com
  2007-02-12  8:53 ` [Bug c++/30771] " dcb314 at hotmail dot com
  2007-02-12  9:58 ` rguenth at gcc dot gnu dot org
@ 2007-02-12 10:11 ` dorit at il dot ibm dot com
  2007-02-12 14:23 ` [Bug tree-optimization/30771] " dorit at il dot ibm dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dorit at il dot ibm dot com @ 2007-02-12 10:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dorit at il dot ibm dot com  2007-02-12 10:11 -------
I'll look into it.


-- 


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


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

* [Bug tree-optimization/30771] ice for legal code with -O2 -ftree-vectorize
  2007-02-12  8:52 [Bug c++/30771] New: ice for legal code with -O2 -ftree-vectorize dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2007-02-12 10:11 ` dorit at il dot ibm dot com
@ 2007-02-12 14:23 ` dorit at il dot ibm dot com
  2007-02-14  5:26 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dorit at il dot ibm dot com @ 2007-02-12 14:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dorit at il dot ibm dot com  2007-02-12 14:23 -------
I'm testing the patch below. (wasn;t able to reproduce the problem in the
attched testcase, but here's a reduced testcase for the problem that Richi
described - thanks!:

int a[128];
int
main()
{
  short i;

  for (i=0; i<64; i++){
    a[i] = (int)i;
  }
  return 0;
}

)

Index: tree-vect-analyze.c
===================================================================
--- tree-vect-analyze.c (revision 121843)
+++ tree-vect-analyze.c (working copy)
@@ -97,8 +97,12 @@
   int nbbs = loop->num_nodes;
   block_stmt_iterator si;
   unsigned int vectorization_factor = 0;
+  tree scalar_type;
+  tree phi;
+  tree vectype;
+  unsigned int nunits;
+  stmt_vec_info stmt_info;
   int i;
-  tree scalar_type;

   if (vect_print_dump_info (REPORT_DETAILS))
     fprintf (vect_dump, "=== vect_determine_vectorization_factor ===");
@@ -107,12 +111,67 @@
     {
       basic_block bb = bbs[i];

+      for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+       {
+         stmt_info = vinfo_for_stmt (phi);
+         if (vect_print_dump_info (REPORT_DETAILS))
+           {
+             fprintf (vect_dump, "==> examining phi: ");
+             print_generic_expr (vect_dump, phi, TDF_SLIM);
+           }
+
+         gcc_assert (stmt_info);
+
+         /* Two cases of "relevant" phis: those that define an 
+            induction that is used in the loop, and those that
+            define a reduction.  */
+         if ((STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_loop
+              && STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def)
+             || (STMT_VINFO_RELEVANT (stmt_info) == vect_used_by_reduction
+                 && STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def))
+            {
+             gcc_assert (!STMT_VINFO_VECTYPE (stmt_info));
+              scalar_type = TREE_TYPE (PHI_RESULT (phi));
+
+             if (vect_print_dump_info (REPORT_DETAILS))
+               {
+                 fprintf (vect_dump, "get vectype for scalar type:  ");
+                 print_generic_expr (vect_dump, scalar_type, TDF_SLIM);
+               }
+
+             vectype = get_vectype_for_scalar_type (scalar_type);
+             if (!vectype)
+               {
+                 if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+                   {
+                     fprintf (vect_dump,
+                              "not vectorized: unsupported data-type ");
+                     print_generic_expr (vect_dump, scalar_type, TDF_SLIM);
+                   }
+                 return false;
+               }
+             STMT_VINFO_VECTYPE (stmt_info) = vectype;
+
+             if (vect_print_dump_info (REPORT_DETAILS))
+               {
+                 fprintf (vect_dump, "vectype: ");
+                 print_generic_expr (vect_dump, vectype, TDF_SLIM);
+               }
+
+             nunits = TYPE_VECTOR_SUBPARTS (vectype);
+             if (vect_print_dump_info (REPORT_DETAILS))
+               fprintf (vect_dump, "nunits = %d", nunits);
+
+             if (!vectorization_factor
+                 || (nunits > vectorization_factor))
+               vectorization_factor = nunits;
+           }
+       }
+
       for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
         {
          tree stmt = bsi_stmt (si);
-         unsigned int nunits;
-         stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
-         tree vectype;
+         stmt_info = vinfo_for_stmt (stmt);

          if (vect_print_dump_info (REPORT_DETAILS))
            {
@@ -269,10 +328,11 @@
            return false;
          }

-         if (STMT_VINFO_RELEVANT_P (stmt_info))
+         if (STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_loop
+             && STMT_VINFO_DEF_TYPE (stmt_info) != vect_induction_def)
            {
              /* Most likely a reduction-like computation that is used
-                in the loop.  */
+                in the loop.  */
              if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
                fprintf (vect_dump, "not vectorized: unsupported pattern.");
             return false;
@@ -2235,17 +2295,7 @@

         (case 2)
            If STMT has been identified as defining a reduction variable, then
-          we have two cases:
-          (case 2.1)
-            The last use of STMT is the reduction-variable, which is defined
-            by a loop-header-phi. We don't want to mark the phi as live or
-            relevant (because it does not need to be vectorized, it is handled
-             as part of the vectorization of the reduction), so in this case
we
-            skip the call to vect_mark_relevant.
-          (case 2.2)
-            The rest of the uses of STMT are defined in the loop body. For
-             the def_stmt of these uses we want to set liveness/relevance
-             as follows:
+           we want to set liveness/relevance as follows:
                STMT_VINFO_LIVE_P (DEF_STMT_info) <-- false
                STMT_VINFO_RELEVANT (DEF_STMT_info) <-- vect_used_by_reduction
              because even though STMT is classified as live (since it defines
a
@@ -2297,16 +2347,6 @@
          bb = bb_for_stmt (def_stmt);
          if (!flow_bb_inside_loop_p (loop, bb))
            continue;
-
-         /* case 2.1: the reduction-use does not mark the defining-phi
-            as relevant.  */
-         if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def
-             && TREE_CODE (def_stmt) == PHI_NODE)
-           continue;
-
-         if (dt == vect_induction_def && TREE_CODE (def_stmt) == PHI_NODE)
-           continue;
-
          vect_mark_relevant (&worklist, def_stmt, relevant, live_p);
        }
     }                          /* while worklist */


-- 


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


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

* [Bug tree-optimization/30771] ice for legal code with -O2 -ftree-vectorize
  2007-02-12  8:52 [Bug c++/30771] New: ice for legal code with -O2 -ftree-vectorize dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2007-02-12 14:23 ` [Bug tree-optimization/30771] " dorit at il dot ibm dot com
@ 2007-02-14  5:26 ` patchapp at dberlin dot org
  2007-02-14 14:11 ` dorit at gcc dot gnu dot org
  2007-02-16  1:58 ` [Bug tree-optimization/30771] [4.3 Regression] " pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: patchapp at dberlin dot org @ 2007-02-14  5:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from patchapp at dberlin dot org  2007-02-14 05:26 -------
Subject: Bug number PR tree-optimization/30771

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-02/msg01186.html


-- 


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


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

* [Bug tree-optimization/30771] ice for legal code with -O2 -ftree-vectorize
  2007-02-12  8:52 [Bug c++/30771] New: ice for legal code with -O2 -ftree-vectorize dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2007-02-14  5:26 ` patchapp at dberlin dot org
@ 2007-02-14 14:11 ` dorit at gcc dot gnu dot org
  2007-02-16  1:58 ` [Bug tree-optimization/30771] [4.3 Regression] " pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dorit at gcc dot gnu dot org @ 2007-02-14 14:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dorit at gcc dot gnu dot org  2007-02-14 14:11 -------
Subject: Bug 30771

Author: dorit
Date: Wed Feb 14 14:10:57 2007
New Revision: 121950

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121950
Log:
         PR tree-optimization/30771
        * tree-vect-analyze.c (vect_determine_vectorization_factor): Traverse
        also phi nodes.
        (vect_analyze_operations): Induction phis can now be marked as
        used_in_loop.
        (vect_mark_stmts_to_be_vectorized): No special treatment for phis.
        Update documentation accordingly.


Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr30771.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-analyze.c


-- 


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


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

* [Bug tree-optimization/30771] [4.3 Regression] ice for legal code with -O2 -ftree-vectorize
  2007-02-12  8:52 [Bug c++/30771] New: ice for legal code with -O2 -ftree-vectorize dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2007-02-14 14:11 ` dorit at gcc dot gnu dot org
@ 2007-02-16  1:58 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-16  1:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2007-02-16 01:58 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
            Summary|ice for legal code with -O2 |[4.3 Regression] ice for
                   |-ftree-vectorize            |legal code with -O2 -ftree-
                   |                            |vectorize
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-02-16  1:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-12  8:52 [Bug c++/30771] New: ice for legal code with -O2 -ftree-vectorize dcb314 at hotmail dot com
2007-02-12  8:53 ` [Bug c++/30771] " dcb314 at hotmail dot com
2007-02-12  9:58 ` rguenth at gcc dot gnu dot org
2007-02-12 10:11 ` dorit at il dot ibm dot com
2007-02-12 14:23 ` [Bug tree-optimization/30771] " dorit at il dot ibm dot com
2007-02-14  5:26 ` patchapp at dberlin dot org
2007-02-14 14:11 ` dorit at gcc dot gnu dot org
2007-02-16  1:58 ` [Bug tree-optimization/30771] [4.3 Regression] " 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).