[Bug ipa/84658] [7/8 Regression] -O3 -fmerge-all-constants causes incorrect for-each loop generation.
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 2 13:08:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84658
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |alias
Status|NEW |ASSIGNED
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is a points-to issue. After inlining we have
static const intD.9 aD.2281[16] = {0, 1, 2, 3, 4, 5, 8, 15, 16, 17, 512,
1020, 1021, 1022, 1023, 1024};
intD.9 bD.2313;
const intD.9 * __for_beginD.2314;
static const intD.9 aD.2291ptD.2281[16];
...
<bb 3> [100.00%]:
# PT = { D.2281 } (nonlocal)
# ALIGN = 4, MISALIGN = 0
# __for_begin_8 = PHI <&aD.2281(2), __for_begin_10(4)>
if (__for_begin_8 == &MEM[(voidD.43 *)&aD.2281 + 64B])
goto <bb 5>; [5.88%]
good copy!
<bb 6> [100.00%]:
# PT = { D.2291 } (nonlocal)
# ALIGN = 4, MISALIGN = 0
# __for_begin_5 = PHI <&aD.2291ptD.2281(5), __for_begin_7(7)>
if (__for_begin_5 == &MEM[(voidD.43 *)&aD.2291ptD.2281 + 64B])
goto <bb 8>; [5.88%]
else
goto <bb 7>; [94.12%]
bad copy! See how __for_begin_5 only points to D.2291 -- remember the
points-to sets are just bits. But the DECL we check against has
been adjusted to the DECL_PT_UID of 2281...
I guess this is finally a case where we wondered if we get things correct... :/
I remember saying you need to adjust all existing points-to sets....
Note for the function bodies after inlining I see foo () has points-to
retained but bar () has it seemingly cleared? But maybe this just dump
before applying the IPA ICF transform.
The ICF dump says:
Unified; Variable alias has been created.
Setting points-to UID of [a.2291] as 2281
but then existing points-to sets containing 2291 are not adjusted.
More information about the Gcc-bugs
mailing list