[PATCH PR70715]Expand simple operations in IV.base and check if it's the control_IV

Christophe Lyon christophe.lyon@linaro.org
Fri Apr 22 15:26:00 GMT 2016


On 21 April 2016 at 11:03, Richard Biener <richard.guenther@gmail.com> wrote:
> On Wed, Apr 20, 2016 at 5:08 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>> Hi,
>> As reported in PR70715, GCC failed to prove no-overflows of IV(&p[n]) for simple example like:
>> int
>> foo (char *p, unsigned n)
>> {
>>   while(n--)
>>     {
>>       p[n]='A';
>>     }
>>   return 0;
>> }
>> Actually, code has already been added to handle this form loops when fixing PR68529.  Problem with this case is loop niter analyzer records control_IV with its base expanded by calling expand_simple_operations.  This patch simply adds code expanding BASE before we check its equality against control_IV.base.  In the long run, we might want to remove the use of expand_simple_operations.
>>
>> Bootstrap and test on x86_64.  Is it OK?
>

Hi Bin,

On ARM and AArch64 bare-metal toolchains, this causes

FAIL: gcc.dg/tree-ssa/minmax-2.c scan-tree-dump optimized "__builtin_fmin"

Christophe

> Ok.
>
> Richard.
>
>> Thanks,
>> bin
>>
>>
>> 2016-04-20  Bin Cheng  <bin.cheng@arm.com>
>>
>>         PR tree-optimization/70715
>>         * tree-ssa-loop-niter.c (loop_exits_before_overflow): Check equality
>>         after expanding BASE using expand_simple_operations.



More information about the Gcc-patches mailing list