https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99954
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- OK, so (compute_affine_dependence stmt_a: _1 = MEM[(union container *)p_11 + -4B].value; stmt_b: p_11->value = _1; ) -> no dependence where there is indeed no depedence but it looks like this is the wrong question to be asked. So the cited rev. in question was "wrong" to honor the assertion from classify_builtin_ldst based on dependence analysis. diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 583bb062b76..2ec7d999e21 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -1759,11 +1759,11 @@ loop_distribution::classify_builtin_ldst (loop_p loop, struct graph *rdg, /* Now check that if there is a dependence. */ ddr_p ddr = get_data_dependence (rdg, src_dr, dst_dr); - /* Classify as memcpy if no dependence between load and store. */ + /* Classify as memmove if no dependence between load and store. */ if (DDR_ARE_DEPENDENT (ddr) == chrec_known) { partition->builtin = alloc_builtin (dst_dr, src_dr, base, src_base, size); - partition->kind = PKIND_MEMCPY; + partition->kind = PKIND_MEMMOVE; return; } is the correct thing to do here. That leaves classifciation involving (constant) sizes on the plate we could check the dependence distance against or adjust the later alias check by creating ao_refs with size. In particular this FAILs the added testcase by said ref. Adjusting the alias check for the testcase isn't easy, the dest/src pointers look like (gdb) p debug_generic_expr (src) (double *) par.0_1 + ((sizetype) i_19 * 320 + 4160) $5 = void (gdb) p debug_generic_expr (dest) (double *) par.0_1 + ((sizetype) i_19 * 320 + 1600) $6 = void and there's no nice API do use here. We can use tree-affine to subtract the pointers and compare the difference with the computed size though.