https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107051
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This one is simple to fix. Right now we reject the copy prop due to: ``` /* For 2 memory refences and using a temporary to do the copy, don't remove the temporary as the 2 memory references might overlap. Note t does not need to be decl as it could be field. See PR 22237 for full details. E.g. t = *a; #DEST = SRC; *b = t; #DEST2 = SRC2; Cannot be convert into t = *a; *b = *a; Though the following is allowed to be done: t = *a; *a = t; And convert it into: t = *a; *a = *a; */ if (!operand_equal_p (dest2, src, 0) && !DECL_P (dest2) && !DECL_P (src)) return false; ``` What we need to detect here is that: ``` c = g_284[1]; g_284[0] = c; ``` can be handled. The reason is that g_284[1] and g_284[0] don't overlap for the load/store.