https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63184
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> --- Now to answer Jeff my original idea was to change how VN handles addresses to use tree-affine in there. But that takes some time... Given that we lower non-invariant addresses now another idea would be to recognize _4 = _3 + 4; _5 = &a[1] + _4; and reassociate that to combine the + 4 with the &a[1] (which is &a + 4). Now the reassoc pass associates the constant last which makes this unreliable to detect in a match.pd pattern (the constant may be far away) but the reassoc pass itself could, when associating a chain, look for whether the SSA name we start from is (single-)used in a POINTER_PLUS_EXPR and the constant element in the reassoc ops[] array can be combined with a constant offset in the address operand. I'll see if that works out.