https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94969
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- So I think the issue is not dependence testing but loop distribution accepting a zero dependence distance as OK. Of course dependence analysis is quite useless here since the accesses are to the same location in every iteration. Bin, maybe you can share your thoughts on this issue? The testcase doesn't need bitfields - those just disable the cost model which otherwise prevents the distribution. diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 44423215332..ac272d63c3d 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -2852,6 +2852,7 @@ loop_distribution::finalize_partitions (class loop *loop, /* Don't distribute current loop into too many loops given we don't have memory stream cost model. Be even more conservative in case of loop nest distribution. */ +#if 0 if ((same_type_p && num_builtin == 0 && (loop->inner == NULL || num_normal != 2 || num_partial_memset != 1)) || (loop->inner != NULL @@ -2867,6 +2868,7 @@ loop_distribution::finalize_partitions (class loop *loop, } partitions->truncate (1); } +#endif /* Fuse memset builtins if possible. */ if (partitions->length () > 1) makes the testcase miscompiled even with the : 7 and : 2 commented, so plain struct S { signed m; signed e; };