https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109539
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- So what we try to do is, when check_pointer_uses follows the use chain of 'ptr' through say ptr2 = ptr + 4; then it wants to visit ptr2 uses as well. For PHIs we get to ptr2 = PHI <..., ptr, ...>; and we want to consider uses of ptr2 only if all other PHI arguments are "related" to 'ptr'. To prove that we perform complicated gymnastics, in particular the only real check done is if (!ptr_derefs_may_alias_p (p, q)) return false; and that's of course incredibly weak. To disprove relatedness the pointers_related_p recurses, but only when either of both pointers are defined by a PHI. It uses pointer-query to skip chains of pointer adjustments up to such definition. So we basically do forward relatedness in check_pointer_uses and then backward relatedness in pointers_related_p. I think we should eschew that completely and only try to handle "forward" PHIs by the iteration in check_pointer_uses itself.