https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107888
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot
gnu.org
Status|NEW |ASSIGNED
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So for the second testcase in comment #0 (with __builtin_trap replaced with
__builtin_unreachable so at least we have ranges):
# RANGE [irange] int [5, +INF] NONZERO 0x7fffffff
intD.9 ab_2(D) = abD.2773;
# RANGE [irange] int [-INF, 6]
intD.9 bb_3(D) = bbD.2774;
intD.9 cD.2779;
__BB(2):
if (ab_2(D) >= bb_3(D))
goto __BB4;
else
goto __BB3;
__BB(3):
__BB(4):
# RANGE [irange] int [5, +INF] NONZERO 0x7fffffff
# c_1 = PHI <ab_2(D)(2), 6(3)>
We could detect (cond (a ge b) a CST) and look at CST to see if it is the same
as the max range of b and one more than the min of a. I think that will work.
That will also fix I think the first testcase.
Let me try to do that.
We won't get the __builtin_trap case correctly unless we do the full range
information inside phiopt; I will have to look into that later.