Created attachment 25288 [details] please compile it with -Ofast gfortran -Ofast ICE in vect_do_peeling_for_loop_bound
#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
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; } }
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
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
Fixed.