This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH PR80153]Part1, Get base pointer from the first element of pointer type aff_tree, Simplify add_elt_to_tree
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Bin Cheng <Bin dot Cheng at arm dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>
- Date: Mon, 10 Apr 2017 17:37:24 +0200
- Subject: Re: [PATCH PR80153]Part1, Get base pointer from the first element of pointer type aff_tree, Simplify add_elt_to_tree
- Authentication-results: sourceware.org; auth=none
- References: <VI1PR0802MB2176B7B2E424BD6600BBBB2EE7010@VI1PR0802MB2176.eurprd08.prod.outlook.com>
On Mon, Apr 10, 2017 at 4:35 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> This is another try fixing PR80153. It's based on richi's idea which is easier to understand than my
> previous patch. The patch gets base pointer from the first element of pointer aff_tree, builds result
> expression in aff_tree's type unconditionally. With this patch, A) we can do unconditional type
> conversion on element in add_elt_to_tree, which simplify the function a lot; B) Except for below
> mentioned fallout, customer of aff_tree doesn't need to do explicit conversion for result expression
> of aff_combination_to_tree now.
>
> Though this patch can handle normal constant base pointer_plus_expr, e.g, ((char *)1024 + (size_t)x),
> we still can't handle extreme case in which x is of pointer type and its coef is 1. I believe this is
> a latent problem in tree-affine.c all the time. It's not exposed because the biggest customer (ivopt)
> always generates code in unsigned, rather than pointer type. Let's see if this patch will uncover the issue.
>
> I also need to do more invariant check in rewrite_use_nonlinear_expr for test gcc.dg/tree-ssa/reassoc-19.c.
> It relies on wrong behavior of tree-affine.c addressed in this patch.
>
> Bootstrap and test on X86_64 and AArch64. Is it OK if no failures? The next patch addresses a
> breakage of tree-affine.c usage.
Ok.
Thanks,
Richard.
> Thanks,
> bin
>
> 2017-04-07 Richard Biener <rguenther@suse.de>
> Bin Cheng <bin.cheng@arm.com>
>
> PR tree-optimization/80153
> * tree-affine.c (aff_combination_to_tree): Get base pointer from
> the first element of pointer type aff_tree. Build result expr in
> aff_tree's type.
> (add_elt_to_tree): Convert to type unconditionally. Remove other
> fold_convert calls.
> * tree-ssa-loop-ivopts.c (alloc_iv): Pass in consistent types.
> (rewrite_use_nonlinear_expr): Check invariant using iv information.
>
> gcc/testsuite/ChangeLog
> 2017-04-07 Bin Cheng <bin.cheng@arm.com>
>
> PR tree-optimization/80153
> * gcc.c-torture/execute/pr80153.c: New.