[PATCH PR72817/PR73450]Fix wrong code caused by niter analyzer for NE_EXPR exit cond.
Richard Biener
richard.guenther@gmail.com
Fri Aug 12 08:06:00 GMT 2016
On Thu, Aug 11, 2016 at 6:35 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> I made a mistake when improving loop niter analysis for NE_EXPR exit condition.
> It can results in wrong code as reported in PR72817/PR73450. In previous patch,
> it simplifies below condition:
> base <= FINAL ; step > 0
> base >= FINAL ; step < 0
> into:
> base - step < FINAL ; step > 0 && base - step doesn't underflow
> base - step > FINAL ; step < 0 && base - step doesn't overflow
> But this is not enough. Since we adjusted IV.base to "new_base = IV.base - IV.step"
> in the condition, we need to check if |FINAL - new_base| is multiple of |step| for the
> adjusted base.
>
> This patch fixes the issue as well as revises the comment. Bootstrap and test on
> x86_64. Is it OK?
Ok.
Thanks,
Richard.
> Thanks,
> bin
>
> 2016-08-11 Bin Cheng <bin.cheng@arm.com>
>
> PR tree-optimization/72817
> PR tree-optimization/73450
> * tree-ssa-loop-niter.c (number_of_iterations_ne): Check
> multiple_of_p for adjusted IV.base.
>
> gcc/testsuite/ChangeLog
> 2016-08-11 Bin Cheng <bin.cheng@arm.com>
>
> PR tree-optimization/72817
> PR tree-optimization/73450
> * gcc.dg/tree-ssa/pr72817.c: New test.
> * gcc.dg/tree-ssa/pr73450.c: New test.
More information about the Gcc-patches
mailing list