https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106570
--- Comment #9 from Andrew Macleod <amacleod at redhat dot com> ---
(In reply to Andrew Macleod from comment #2)
> I think this is a duplicate of PR106379 . At the VRP2 stage I see:
>
> <bb 2> [local count: 1073741824]:
> if (c_6(D) == s_7(D))
> goto <bb 3>; [34.00%]
> else
> goto <bb 5>; [66.00%]
>
> <bb 3> [local count: 365072224]:
> _1 = ~c_6(D);
> _2 = _1 & s_7(D);
> if (_2 != 0)
> goto <bb 4>; [75.00%]
> else
> goto <bb 5>; [25.00%]
>
> <bb 4> [local count: 628138969]:
> DCEMarker0_ ();
>
> <bb 5> [local count: 1073741824]:
> return;
>
> Which is basically the identical sequence.. it just took longer to get to it
> :-) We aren't removing this yet with ranger as I need to get to integrate
> rangers relation oracle with the simplifier so that it will see that _2 =
> ~s_7 & s_7.
Indeed. Even in EVRP at -O2 I see:
c_14(D) [irange] _Bool VARYING
s_15(D) [irange] _Bool VARYING
Equivalence set : [c_14(D), s_15(D)]
<bb 3> :
_4 = ~c_14(D);
_5 = _4 & s_15(D);
if (_5 != 0)
goto <bb 6>; [INV]
else
goto <bb 4>; [INV]
so when evaluating _4 & s_15(D), we know c_14 and s_15 are in an equivalence
set, so a relation query from simplification would indicate VREL_EQUAL, and _5
could be recognized as (~A & A) set to 0 and everything goes away.