[PATCH] Fix PR23603, teach VRP about comparison/truthop result ranges

Richard Guenther richard.guenther@gmail.com
Sun Jan 7 23:50:00 GMT 2007


This fixes VRP to fall back to [0,1] instead of varying where a truthvalue
is the result and the TYPE_PRECISION covers more than [0,1].

It also adjusts vrp_visit_phi_node to not so conservatively fall back
to +INF/-INF if all PHI arguments visited are constant (this fixes the
second testcase).

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Will apply to mainline tomorrow.

Richard.

2007-01-07  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/23603
        * tree-vrp.c (set_value_range_to_truthvalue): New function.
        (extract_range_from_binary): Fall back to truthvalue instead of
        varying for TRUTH_*_EXPR.
        (extract_range_from_comparison): Fall back to truthvalue instead of
        varying.
        (vrp_visit_phi_node): Don't adjust new range bounds to +INF/-INF
        if all visited PHI values were constant.

        * gcc.dg/tree-ssa/vrp31.c: New testcase.
        * gcc.dg/tree-ssa/vrp32.c: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-pr23603.diff
Type: text/x-patch
Size: 4425 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070107/dbfb0371/attachment.bin>


More information about the Gcc-patches mailing list