https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61680
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work|4.10.0 |5.0 --- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> --- For 4.8 we can't backport the patch as group analysis and dependence analysis are still the wrong way around. A simple Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c (revision 215073) +++ gcc/tree-vect-data-refs.c (working copy) @@ -2307,6 +2307,17 @@ vect_analyze_group_access (struct data_r while (next) { + /* Check that there is no load-store dependencies for this loads + to prevent a case of load-store-load to the same location. */ + if (GROUP_READ_WRITE_DEPENDENCE (vinfo_for_stmt (next)) + || GROUP_READ_WRITE_DEPENDENCE (vinfo_for_stmt (prev))) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "READ_WRITE dependence in interleaving."); + return false; + } + /* Skip same data-refs. In case that two or more stmts share data-ref (supported only for loads), we vectorize only the first stmt, and the rest get their vectorized loads from the first @@ -2323,17 +2334,6 @@ vect_analyze_group_access (struct data_r return false; } - /* Check that there is no load-store dependencies for this loads - to prevent a case of load-store-load to the same location. */ - if (GROUP_READ_WRITE_DEPENDENCE (vinfo_for_stmt (next)) - || GROUP_READ_WRITE_DEPENDENCE (vinfo_for_stmt (prev))) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "READ_WRITE dependence in interleaving."); - return false; - } - /* For load use the same data-ref load. */ GROUP_SAME_DR_STMT (vinfo_for_stmt (next)) = prev; will regress testcases in vect.exp. Like with two other 4.8 vectorizer miscompiles it's hard to fix them without turning the vectorizer upside down (aka backport most of the re-org from GCC 4.9).