This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/60001] VRP fails to fold identical unsigned comparisons
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 31 Jan 2014 10:37:11 +0000
- Subject: [Bug tree-optimization/60001] VRP fails to fold identical unsigned comparisons
- Auto-submitted: auto-generated
- References: <bug-60001-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60001
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-01-31
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
<bb 4>:
p_10 = ASSERT_EXPR <p_1(D), p_1(D) < q_2(D)>;
q_11 = ASSERT_EXPR <q_2(D), q_2(D) > p_10>;
if (p_10 >= q_11)
goto <bb 5>;
else
goto <bb 6>;
Visiting statement:
p_10 = ASSERT_EXPR <p_1(D), p_1(D) < q_2(D)>;
Intersecting
[0, q_2(D) + 4294967295] EQUIVALENCES: { p_1(D) } (1 elements)
and
VARYING
to
[0, q_2(D) + 4294967295] EQUIVALENCES: { p_1(D) } (1 elements)
Found new range for p_10: [0, q_2(D) + 4294967295]
Visiting statement:
q_11 = ASSERT_EXPR <q_2(D), q_2(D) > p_10>;
Intersecting
[p_10 + 1, +INF] EQUIVALENCES: { q_2(D) } (1 elements)
and
VARYING
to
[p_10 + 1, +INF] EQUIVALENCES: { q_2(D) } (1 elements)
Found new range for q_11: [p_10 + 1, +INF]
Visiting conditional with predicate: if (p_10 >= q_11)
With known ranges
p_10: [0, q_2(D) + 4294967295] EQUIVALENCES: { p_1(D) } (1 elements)
q_11: [p_10 + 1, +INF] EQUIVALENCES: { q_2(D) } (1 elements)
Predicate evaluates to: DON'T KNOW
Why we don't fold this we should
see that p_10 >= q_11 is equivalent to p_10 >= [p_10 + 1, +INF]
Ah. It doesn't even ask that. I can make it ask [p_10 + 1, +INF] <= p_10.
Then it says that p_10 and +INF are un-ordered (it doesn't see that p_10
cannot be +INF because then [p_10 + 1, +INF] wouldn't be a valid range).
Similar it says that p_10 + 1 and p_10 are un-ordered because if p_10 is
+INF then p_10 + 1 will wrap.
So compare_range_with_value needs to be more sophisticated for these cases
(involving symbolic ranges).