https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114737
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-04-16
Status|UNCONFIRMED |NEW
Keywords| |alias, missed-optimization
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. points-to analysis does not track pointer offsets for the final
points-to sets, so tostore and p1 point to the same object. Specifically
pointer offset gathering when setting up the ao_ref for *to_store_1
doesn't look through PHIs:
<bb 3> :
# PT = nonlocal null
tostore_11 = p1_2(D) + 2;
goto <bb 5>; [INV]
<bb 4> :
# PT = nonlocal null
tostore_10 = p1_2(D) + 5;
<bb 5> :
# PT = nonlocal null
# tostore_1 = PHI <tostore_11(3), tostore_10(4)>
*tostore_1 = 1;
what in this case would help a little bit is if this were
<bb 3> :
goto <bb 5>; [INV]
<bb 4> :
<bb 5> :
# PT = nonlocal null
# offset_3 = PHI <2(3), 5(4)>
# PT = nonlocal null
tostore_1 = p1_2(D) + offset_3;
*tostore_1 = 1;
then eventually range-info for offset_3 could be used to constrain the
ao_ref.