https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102540
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aldyh at gcc dot gnu.org,
| |amacleod at redhat dot com
Blocks| |85316
Version|unknown |12.0
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
FRE1 has the following difference, simplifying the (unsigned int) truncation.
<bb 2> :
a.0_1 = a;
_2 = (unsigned int) a.0_1;
b = _2;
- c_10 = (long int) _2;
+ _6 = a.0_1 & 4294967295;
+ c_10 = _6;
if (c_10 != 0)
goto <bb 3>; [INV]
else
where the EVRP which now uses ranger retains (diff from GCC 11 to trunk):
<bb 2> :
a.0_1 = a;
_2 = (unsigned int) a.0_1;
b = _2;
- c_10 = (long int) _2;
+ _6 = a.0_1 & 4294967295;
+ c_10 = _6;
if (c_10 != 0)
goto <bb 3>; [INV]
else
- goto <bb 4>; [INV]
+ goto <bb 6>; [INV]
<bb 3> :
_4 = c_10 + 1;
iftmp.2_12 = 2 / _4;
+ if (iftmp.2_12 != 0)
+ goto <bb 4>; [INV]
+ else
+ goto <bb 6>; [INV]
<bb 4> :
+ if (_2 == 0)
+ goto <bb 5>; [INV]
+ else
+ goto <bb 6>; [INV]
+
+ <bb 5> :
+ foo ();
+
+ <bb 6> :
a = 0;
return 0;
after EVRP we have
+ # RANGE [0, 4294967295] NONZERO 4294967295
c_10 = _6;
...
+ # RANGE [2, 4294967296] NONZERO 8589934591
_4 = c_10 + 1;
+ # RANGE [0, 1] NONZERO 1
iftmp.2_12 = 2 / _4;
if (iftmp.2_12 != 0)
what we did in GCC 11 is simplified the following check
<bb 4> :
if (_2 == 0)
goto <bb 5>; [INV]
else
goto <bb 6>; [INV]
based on iftmp.2_12 == [1, 1] via ranger and
evrp visiting BB4
Visiting controlling predicate if (iftmp.2_12 != 0)
Adding assert for iftmp.2_12 from iftmp.2_12 != 0
Intersecting
long int ~[0, 0] EQUIVALENCES: { iftmp.2_12 } (1 elements)
and
long int [0, 1]
to
long int [1, 1] EQUIVALENCES: { iftmp.2_12 } (1 elements)
Intersecting
long int [0, 1]
and
long int [1, 1]
to
long int [1, 1]
pushing new range for iftmp.2_12: long int [1, 1] EQUIVALENCES: { iftmp.2_12 }
(1 elements)
evrp visiting stmt if (_2 == 0)
Folding statement: if (_2 == 0)
Visiting conditional with predicate: if (_2 == 0)
With known ranges
_2: unsigned int [1, +INF] EQUIVALENCES: { _2 } (1 elements)
Predicate evaluates to: 0
Folded into: if (0 != 0)
that's now missing, somehow due to the folded IL if the bisect is correct.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases