This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, vrp] Allow VRP type conversion folding only for widenings upto word mode
- From: Richard Biener <rguenther at suse dot de>
- To: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>,gcc-patches at gcc dot gnu dot org
- Cc: law at redhat dot com
- Date: Sat, 14 Nov 2015 09:57:40 +0100
- Subject: Re: [Patch, vrp] Allow VRP type conversion folding only for widenings upto word mode
- Authentication-results: sourceware.org; auth=none
- References: <20151114071148 dot GA16647 at jaguar dot atmel dot com> <alpine dot DEB dot 2 dot 20 dot 1511140907420 dot 1923 at laptop-mg dot saclay dot inria dot fr> <20151114084928 dot GA749 at jaguar dot atmel dot com>
On November 14, 2015 9:49:28 AM GMT+01:00, Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> wrote:
>On Sat, Nov 14, 2015 at 09:13:41AM +0100, Marc Glisse wrote:
>> On Sat, 14 Nov 2015, Senthil Kumar Selvaraj wrote:
>>
>> >This patch came out of a discussion held in the gcc mailing list
>> >(https://gcc.gnu.org/ml/gcc/2015-11/msg00067.html).
>> >
>> >The patch restricts folding of conditional exprs with lhs previously
>> >set by a type conversion to occur only if the source of the type
>> >conversion's mode is word mode or smaller.
>> >
>> >Bootstrapped and reg tested on x86_64 (with
>--enable-languages=c,c++).
>> >
>> >If ok, could you commit please? I don't have commit access.
>> >
>> >Regards
>> >Senthil
>> >
>> >gcc/ChangeLog
>> >
>> >2015-11-11 Senthil Kumar Selvaraj
><senthil_kumar.selvaraj@atmel.com>
>> >
>> > * tree-vrp.c (simplify_cond_using_ranges): Fold only
>> > if innerop's mode is word_mode or smaller.
>> >
>> >
>> >diff --git gcc/tree-vrp.c gcc/tree-vrp.c
>> >index e2393e4..c139bc6 100644
>> >--- gcc/tree-vrp.c
>> >+++ gcc/tree-vrp.c
>> >@@ -9467,6 +9467,8 @@ simplify_cond_using_ranges (gcond *stmt)
>> > innerop = gimple_assign_rhs1 (def_stmt);
>> >
>> > if (TREE_CODE (innerop) == SSA_NAME
>> >+ && (GET_MODE_SIZE(TYPE_MODE(TREE_TYPE(innerop)))
>> >+ <= GET_MODE_SIZE(word_mode))
>> > && !POINTER_TYPE_P (TREE_TYPE (innerop)))
>> > {
>> > value_range *vr = get_value_range (innerop);
>>
>> I thought the result of the discussion was that the transformation is
>ok if
>> either it is narrowing or it widens but to something no bigger than
>> word_mode. So you should have 2 comparisons, or 1 with a max.
>
>Hmm, I came to the opposite conclusion - I thought Richard only okayed
>"widening upto word-mode", not the narrowing.
I didn't mean to suggest narrowing is not OK. In fact narrowing is always OK.
Richard.
>Richard?
>
>Regards
>Senthil
>>
>> --
>> Marc Glisse