On Mon, Apr 10, 2017 at 4:35 PM, Bin Cheng <bin.ch...@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  <rguent...@suse.de>
>             Bin Cheng  <bin.ch...@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.ch...@arm.com>
>
>         PR tree-optimization/80153
>         * gcc.c-torture/execute/pr80153.c: New.

Reply via email to