Bug 50412 - [4.6/4.7 Regression] gfortran -Ofast ICE in vect_do_peeling_for_loop_bound
Summary: [4.6/4.7 Regression] gfortran -Ofast ICE in vect_do_peeling_for_loop_bound
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Ira Rosen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-15 08:44 UTC by Vittorio Zecca
Modified: 2011-09-25 09:26 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-09-15 00:00:00


Attachments
please compile it with -Ofast (208 bytes, text/plain)
2011-09-15 08:44 UTC, Vittorio Zecca
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vittorio Zecca 2011-09-15 08:44:07 UTC
Created attachment 25288 [details]
please compile it with -Ofast

gfortran -Ofast ICE in vect_do_peeling_for_loop_bound
Comment 1 Joost VandeVondele 2011-09-15 10:05:27 UTC
#0  internal_error (gmsgid=0x117c39a "in %s, at %s:%d") at ../../gcc/gcc/diagnostic.c:833
#1  0x0000000000e3f394 in fancy_abort (file=Unhandled dwarf expression opcode 0xf3
) at ../../gcc/gcc/diagnostic.c:893
#2  0x0000000000aa5fce in vect_do_peeling_for_loop_bound (loop_vinfo=0x16e3870, ratio=0x7fffffffda58, cond_expr=0x0, cond_expr_stmt_list=0x0)
    at ../../gcc/gcc/tree-vect-loop-manip.c:1931
#3  0x0000000000aa1c7c in vect_transform_loop (loop_vinfo=0x16e3870) at ../../gcc/gcc/tree-vect-loop.c:5161
#4  0x0000000000aae7e3 in vectorize_loops () at ../../gcc/gcc/tree-vectorizer.c:214
#5  0x0000000000876d37 in execute_one_pass (pass=0x1498f00) at ../../gcc/gcc/passes.c:2063
Comment 2 Ira Rosen 2011-09-15 11:40:59 UTC
The problem is that we don't support loop peeling for outer loops, but we support single element interleaving that may require peeling. I'll test this patch:

Index: tree-vect-data-refs.c
===================================================================
--- tree-vect-data-refs.c       (revision 178780)
+++ tree-vect-data-refs.c       (working copy)
@@ -2055,6 +2059,10 @@ vect_analyze_group_access (struct data_r
   HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step);
   HOST_WIDE_INT stride, last_accessed_element = 1;
   bool slp_impossible = false;
+  struct loop *loop = NULL;
+
+  if (loop_vinfo)
+    loop = LOOP_VINFO_LOOP (loop_vinfo);

   /* For interleaving, STRIDE is STEP counted in elements, i.e., the size of the
      interleaving group (including gaps).  */
@@ -2085,11 +2093,17 @@ vect_analyze_group_access (struct data_r

          if (loop_vinfo)
            {
-             LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
-
              if (vect_print_dump_info (REPORT_DETAILS))
                fprintf (vect_dump, "Data access with gaps requires scalar "
                                    "epilogue loop");
+              if (loop->inner)
+                {
+                  if (vect_print_dump_info (REPORT_DETAILS))
+                    fprintf (vect_dump, "Peeling for outer loop is not supported");
+                  return false;
+                }
+
+             LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
            }

          return true;
@@ -2272,10 +2286,17 @@ vect_analyze_group_access (struct data_r
       /* There is a gap in the end of the group.  */
       if (stride - last_accessed_element > 0 && loop_vinfo)
        {
-         LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
          if (vect_print_dump_info (REPORT_DETAILS))
            fprintf (vect_dump, "Data access with gaps requires scalar "
                                "epilogue loop");
+          if (loop->inner)
+            {
+              if (vect_print_dump_info (REPORT_DETAILS))
+                fprintf (vect_dump, "Peeling for outer loop is not supported");
+              return false;
+            }
+
+         LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
        }
     }
Comment 3 irar 2011-09-18 08:59:58 UTC
Author: irar
Date: Sun Sep 18 08:59:52 2011
New Revision: 178940

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

        PR tree-optimization/50412
        * tree-vect-data-refs.c (vect_analyze_group_access): Fail for
        acceses that require epilogue loop if vectorizing outer loop.


Added:
    trunk/gcc/testsuite/gfortran.dg/vect/pr50412.f90
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-data-refs.c
Comment 4 irar 2011-09-25 09:04:24 UTC
Author: irar
Date: Sun Sep 25 09:04:19 2011
New Revision: 179160

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

        PR tree-optimization/50412
        * tree-vect-data-refs.c (vect_analyze_group_access): Fail for
        accesses that require epilogue loop if vectorizing outer loop.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/vect/pr50412.f90
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
Comment 5 Ira Rosen 2011-09-25 09:26:59 UTC
Fixed.