[PATCH GCC][rework]Improve loop bound info by simplifying conversions in iv base

Richard Biener richard.guenther@gmail.com
Wed Sep 16 12:41:00 GMT 2015


On Tue, Sep 15, 2015 at 7:57 AM, Bin.Cheng <amker.cheng@gmail.com> wrote:
> Ping.

Ok.

Thanks,
Richard.

> On Thu, Aug 27, 2015 at 5:41 PM, Bin Cheng <bin.cheng@arm.com> wrote:
>> Hi,
>> This is a rework for
>> https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02335.html, with review
>> comments addressed.  For now, SCEV may compute iv base in the form of
>> "(signed T)((unsigned T)base + step))".  This complicates other
>> optimizations/analysis depending on SCEV because it's hard to dive into type
>> conversions.  This kind of type conversions can be simplified with
>> additional range information implied by loop initial conditions.  This patch
>> does such simplification.
>> With simplified iv base, loop niter analysis can compute more accurate bound
>> information since sensible value range can be derived for "base+step".  For
>> example, accurate loop bound&may_be_zero information is computed for cases
>> added by this patch.
>>
>> The code is actually moved from loop_exits_before_overflow.  After this
>> patch, the corresponding code in loop_exits_before_overflow will be never
>> executed, so I removed that part code.  The patch also includes some code
>> format changes.
>>
>> Bootstrap and test on x86_64.  Is it OK?
>>
>> Thanks,
>> bin
>>
>> 2015-08-27  Bin Cheng  <bin.cheng@arm.com>
>>
>>         * tree-ssa-loop-niter.c (tree_simplify_using_condition_1): Support
>>         new parameter.
>>         (tree_simplify_using_condition): Ditto.
>>         (simplify_using_initial_conditions): Ditto.
>>         (loop_exits_before_overflow): Pass new argument to function
>>         simplify_using_initial_conditions.  Remove case for type conversions
>>         simplification.
>>         * tree-ssa-loop-niter.h (simplify_using_initial_conditions): New
>>         parameter.
>>         * tree-scalar-evolution.c (simple_iv): Simplify type conversions
>>         in iv base using loop initial conditions.
>>
>> gcc/testsuite/ChangeLog
>> 2015-08-27  Bin Cheng  <bin.cheng@arm.com>
>>
>>         * gcc.dg/tree-ssa/loop-bound-2.c: New test.
>>         * gcc.dg/tree-ssa/loop-bound-4.c: New test.
>>         * gcc.dg/tree-ssa/loop-bound-6.c: New test.



More information about the Gcc-patches mailing list