This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: VRP: abstract out wide int CONVERT_EXPR_P code
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 28 Aug 2018 11:27:03 +0200
- Subject: Re: VRP: abstract out wide int CONVERT_EXPR_P code
- References: <ca140cb9-b884-6ff2-3a6e-494fb22cee22@redhat.com>
On Mon, Aug 27, 2018 at 2:24 PM Aldy Hernandez <aldyh@redhat.com> wrote:
>
> Howdy!
>
> Phew, I think this is the last abstraction. This handles the unary
> CONVERT_EXPR_P code.
>
> It's the usual story-- normalize the symbolics to [-MIN,+MAX] and handle
> everything generically.
>
> Normalizing the symbolics brought about some nice surprises. We now
> handle a few things we were punting on before, which I've documented in
> the patch, but can remove if so desired. I wrote them mainly for myself:
>
> /* NOTES: Previously we were returning VARYING for all symbolics, but
> we can do better by treating them as [-MIN, +MAX]. For
> example, converting [SYM, SYM] from INT to LONG UNSIGNED,
> we can return: ~[0x8000000, 0xffffffff7fffffff].
>
> We were also failing to convert ~[0,0] from char* to unsigned,
> instead choosing to return VR_VARYING. Now we return ~[0,0]. */
>
> Tested on x86-64 by the usual bootstrap and regtest gymnastics,
> including --enable-languages=all, because my past sins are still
> haunting me.
>
> OK?
The new wide_int_range_convert_tree looks odd given it returns
tree's. I'd have expected an API that does the conversion resulting
in a wide_int range and the VRP code adapting to that by converting
the result to trees.
Richard.