https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86605
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #4) > (In reply to Andrew Pinski from comment #3) > > So on the trunk we get: > > if (&test != 4B) > > goto <bb 4>; [70.00%] > > else > > goto <bb 3>; [30.00%] > > > > <bb 3> [local count: 322122544]: > > > > <bb 4> [local count: 1073741824]: > > # iftmp.0_3 = PHI <10(2), 20(3)> > > > > I know we fold &v != 0B but it seems like if the constant is within a few > > bytes of 0, we should fold it similar. Shouldn't we? > > Interesting we fold "&test != 4B" on aarch64-linux-gnu but not on > x86_64-linux-gnu. > > If we change 4 to 16, we don't fold on either. Probably sth do to with alignment. Seriously, I don't think we can choose some arbitrary constant and say everything < N is equal to "NULL". So I don't think optimizing this as wanted by the reporter is valid.