https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111157
Martin Jambor <jamborm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |jamborm at gcc dot gnu.org Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2023-08-25 --- Comment #2 from Martin Jambor <jamborm at gcc dot gnu.org> --- With the propagation, PRE performs the following: void point.constprop.isra (double ISRA.1740, int & restrict ipoint, double & restrict x, double & restrict y, double & restrict z, int & restrict istat) { int iy; int ix; double & restrict prploc; int _5; - int _9; int _11; int _12; long int _13; @@ -13284,7 +15377,6 @@ <bb 2> [local count: 1073741824]: # DEBUG D#556 s=> prploc # DEBUG prploc => D#556 - *istat_1(D) = 0; if (ISRA.1740_70(D) != 6.08805302369215843745180305174265706886482420102590225625e-154) goto <bb 7>; [50.00%] else @@ -13301,8 +15393,7 @@ calcom (x_6(D), y_7(D), z_8(D)); <bb 5> [local count: 536870912]: - _9 = *ipoint_4(D); - if (_9 > 1) + if (_5 > 1) goto <bb 6>; [59.00%] else goto <bb 25>; [41.00%] The write of zero to where we know there is already zero is however problematic because all callers expect the pointed to value to be overwritten and dse2 pass does: @@ -20229,7 +14076,6 @@ xpt = 0.0; ypt = 0.0; zpt = 0.0; - istat = 0; point.constprop.isra (_73, &ipoint, &xpt, &ypt, &zpt, &istat); _77 = istat; if (_77 < 0) So I guess this is a nasty interaction with IPA-modref, and indeed -fno-ipa-modref avoids the issue. I'll discuss with Honza whether IPA-modref can be modified to kill the known values in summaries in such cases or whether it is IPA-CP that should avoid "knowing" the value.