https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80705
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Ok, SLP seems fine here, on x86_64 needs -fno-vect-cost-model to vectorize it. LIM also looks fine on x86 (does nothing) so it must be IVOPTs messing up the refs on ppc64le. Ah, on ppc64le: vect_cst__43 = {__gcov0.foo_I_lsm.13_187, __gcov0.foo_I_lsm.10_168}; vect_cst__152 = {__gcov0.foo_I_lsm.11_105, __gcov0.foo_I_lsm.12_164}; vect_cst__178 = {__gcov0.foo_I_lsm.14_204, PROF_edge_counter_193}; MEM[(long int *)&__gcov0.foo + 32B] = vect_cst__178; _198 = &__gcov0.foo[4] + 16; MEM[(long int *)_198] = vect_cst__152; _39 = _198 + 16; MEM[(long int *)_39] = vect_cst__43; actually similar on x86_64 without AVX: vect_cst__174 = {__gcov0.foo_I_lsm.10_109, __gcov0.foo_I_lsm.11_164}; vect_cst__36 = {__gcov0.foo_I_lsm.12_147, PROF_edge_counter_167}; MEM[(long int *)&__gcov0.foo + 24B] = vect_cst__36; _181 = &__gcov0.foo[3] + 16; MEM[(long int *)_181] = vect_cst__174; the last ref is problematic as it aliases __gcov0.foo and that is not allowed. I presume that vectorizing the counter update stores isn't really useful anyway, so the easiest thing may be to simply not allow vectorizing DECL_NONALIASED refs. Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c (revision 247879) +++ gcc/tree-vect-data-refs.c (working copy) @@ -3957,6 +4023,27 @@ again: datarefs[i] = dr; } + if (TREE_CODE (DR_BASE_ADDRESS (dr)) == ADDR_EXPR + && DECL_P (TREE_OPERAND (DR_BASE_ADDRESS (dr), 0)) + && DECL_NONALIASED (TREE_OPERAND (DR_BASE_ADDRESS (dr), 0))) + { + if (dump_enabled_p ()) + { + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: base object not addressable " + "for stmt: "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); + } + if (is_a <bb_vec_info> (vinfo)) + { + /* In BB vectorization the ref can still participate + in dependence analysis, we just can't vectorize it. */ + STMT_VINFO_VECTORIZABLE (stmt_info) = false; + continue; + } + return false; + } + /* Set vectype for STMT. */ scalar_type = TREE_TYPE (DR_REF (dr)); STMT_VINFO_VECTYPE (stmt_info)