Re: [PATCH] Make VRP optimize useless conversions

2011-08-12 Thread H.J. Lu
On Mon, Jul 11, 2011 at 5:12 AM, Richard Guenther rguent...@suse.de wrote: On Fri, 8 Jul 2011, Richard Guenther wrote: On Fri, 8 Jul 2011, Michael Matz wrote: Hi, On Fri, 8 Jul 2011, Richard Guenther wrote: It should be indeed safe with the current handling of conversions, but

Re: Build failure (Re: [PATCH] Make VRP optimize useless conversions)

2011-07-13 Thread Richard Guenther
On Tue, 12 Jul 2011, Ulrich Weigand wrote: Richard Guenther wrote: 2011-07-11 Richard Guenther rguent...@suse.de * tree-vrp.c (simplify_conversion_using_ranges): Manually translate the source value-range through the conversion chain. This causes a build failure in

Re: Build failure (Re: [PATCH] Make VRP optimize useless conversions)

2011-07-13 Thread H.J. Lu
On Wed, Jul 13, 2011 at 1:28 AM, Richard Guenther rguent...@suse.de wrote: On Tue, 12 Jul 2011, Ulrich Weigand wrote: Richard Guenther wrote: 2011-07-11  Richard Guenther  rguent...@suse.de     * tree-vrp.c (simplify_conversion_using_ranges): Manually     translate the source

Re: Build failure (Re: [PATCH] Make VRP optimize useless conversions)

2011-07-13 Thread Ulrich Weigand
Richard Guenther wrote: 2011-07-13 Richard Guenther rguent...@suse.de * tree-vrp.c (simplify_conversion_using_ranges): Make sure the final type is integral. This fixes the spu-elf build failure. Thanks, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z

Re: [PATCH] Make VRP optimize useless conversions

2011-07-11 Thread Richard Guenther
On Fri, 8 Jul 2011, Richard Guenther wrote: On Fri, 8 Jul 2011, Michael Matz wrote: Hi, On Fri, 8 Jul 2011, Richard Guenther wrote: It should be indeed safe with the current handling of conversions, but better be safe. So, like the following? No. The point is that you

Re: [PATCH] Make VRP optimize useless conversions

2011-07-11 Thread Michael Matz
Hi, On Mon, 11 Jul 2011, Richard Guenther wrote: The following actually works. Bootstrapped and tested on x86_64-unknown-linux-gnu. Can you double-check it? Seems sensible. Given this: short s; int i; for (s = 0; s = 127; s++) i += (signed char)(unsigned char)s; return i;

Re: [PATCH] Make VRP optimize useless conversions

2011-07-08 Thread Richard Guenther
On Thu, 7 Jul 2011, Michael Matz wrote: Hi, On Thu, 7 Jul 2011, Richard Guenther wrote: + tree rhs1 = gimple_assign_rhs1 (stmt); + gimple def_stmt = SSA_NAME_DEF_STMT (rhs1); + value_range_t *final, *inner; + + /* Obtain final and inner value-ranges for a conversion +

Re: [PATCH] Make VRP optimize useless conversions

2011-07-08 Thread Michael Matz
Hi, On Fri, 8 Jul 2011, Richard Guenther wrote: It should be indeed safe with the current handling of conversions, but better be safe. So, like the following? No. The point is that you can't compare the bounds that VRP computes with each other when the outcome affects correctness. Think

Re: [PATCH] Make VRP optimize useless conversions

2011-07-08 Thread Richard Guenther
On Fri, 8 Jul 2011, Michael Matz wrote: Hi, On Fri, 8 Jul 2011, Richard Guenther wrote: It should be indeed safe with the current handling of conversions, but better be safe. So, like the following? No. The point is that you can't compare the bounds that VRP computes with each

[PATCH] Make VRP optimize useless conversions

2011-07-07 Thread Richard Guenther
The following patch teaches VRP to disregard the intermediate conversion in a sequence (T1)(T2)val if that sequence is value-preserving for val. There are possibly some more cases that could be handled when a sign-change is involved but the following is a first safe step. Bootstrapped on

Re: [PATCH] Make VRP optimize useless conversions

2011-07-07 Thread Michael Matz
Hi, On Thu, 7 Jul 2011, Richard Guenther wrote: + tree rhs1 = gimple_assign_rhs1 (stmt); + gimple def_stmt = SSA_NAME_DEF_STMT (rhs1); + value_range_t *final, *inner; + + /* Obtain final and inner value-ranges for a conversion + sequence