https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68559
Bug ID: 68559 Summary: Excessive peeling for gaps Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Blocks: 53947 Target Milestone: --- With N == 20 gcc.dg/vect/pr45752.c only contains the peeling-for-gap copy because of the following premature check which doesn't consider the group being vectorized using SLP (or three-element interleaving). SLP will never require gap peeling for exact_log2 (groupsize) == -1 and three-element interleaving neither. The LOOP_VINFO_PEELING_FOR_GAPS analysis should be postponed (apart from the single-element interleaving case). static bool vect_analyze_group_access_1 (struct data_reference *dr) { ... /* If there is a gap in the end of the group or the group size cannot be made a multiple of the vector element count then we access excess elements in the last iteration and thus need to peel that off. */ if (loop_vinfo && (groupsize - last_accessed_element > 0 || exact_log2 (groupsize) == -1)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, "Data access with gaps requires scalar " "epilogue loop\n"); if (loop->inner) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, "Peeling for outer loop is not supported\n"); return false; } LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true; Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947 [Bug 53947] [meta-bug] vectorizer missed-optimizations