This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH 2/3]Improve induction variable elimination
- From: "Bin.Cheng" <amker dot cheng at gmail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Bin Cheng <bin dot cheng at arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 25 Jul 2014 15:03:55 +0100
- Subject: Re: [PATCH 2/3]Improve induction variable elimination
- Authentication-results: sourceware.org; auth=none
- References: <002e01cfa19e$ac13fed0$043bfc70$ at arm dot com> <CAFiYyc1asoW_ZjA0DXJP_SfM7OC=c9W0dpj+V1zQ=TxfZseqqQ at mail dot gmail dot com>
On Fri, Jul 25, 2014 at 1:35 PM, Richard Biener
> On Thu, Jul 17, 2014 at 11:08 AM, Bin Cheng <firstname.lastname@example.org> wrote:
>> As quoted from the function difference_cannot_overflow_p,
>> /* TODO: deeper inspection may be necessary to prove the equality. */
>> switch (code)
>> case PLUS_EXPR:
>> return expr_equal_p (e1, offset) || expr_equal_p (e2, offset);
>> case POINTER_PLUS_EXPR:
>> return expr_equal_p (e2, offset);
>> return false;
>> The overflow check can be improved by using deeper inspection to prove the
>> equality. This patch deals with that by making below two improvements:
>> a) Handles constant cases.
>> b) Uses affine expansion as deeper inspection to check the equality.
>> As a result, functions strip_wrap_conserving_type_conversions and
>> expr_equal_p can be removed now. A test case is also added to illustrate iv
>> elimination opportunity captured by this patch.
> You add special casing for constants but I don't see any testcases for that.
> + /* No overflow if offset is zero. */
> + if (offset == integer_zero_node)
> return true;
> is a bogus check (use integer_zerop). Apart from the special-casing of
Will be changed.
> constants the patch looks good to me.
Ah, Now I can see that handling of constants (here the zero offset
case) is to make the 3rd patch to work. I should include this part of
code in the 3rd patch. Also I will try to reduce testcase for other
non-zero constant scenarios