On Sat, Sep 24, 2011 at 6:41 PM, Eric Botcazou <ebotca...@adacore.com> wrote:
> Hi,
>
> this is a couple of small tweaks to the GIMPLE optimizers aimed at helping
> vectorization in Ada.  More changes will be needed, so no testcases yet.
>
>
>  1. pass_fold_builtins knows how to delete a call to __builtin_stack_restore
> that is the only real statement in a cleanup, i.e. to turn
>
> <L101>:
>  .builtin_stack_restore (saved_stack.116_22);
>  resx 1
>
> into
>
> <L101>:
>  GIMPLE_NOP
>  resx 1
>
> This is valid when the block has no outgoing edge.  Then ehcleanup can in turn
> delete the cleanup as empty.  The problem is that pass_fold_builtins runs very
> late in the game, so most of the optimizations, e.g. vectorization, are
> constrained by the EH structure, all the more so if -fnon-call-exceptions is
> enabled like in Ada.  This happens as soon as you do dynamic stack allocation,
> because then you have a call to __builtin_stack_restore in the FINALLY part of
> a TRY-FINALLY structure, hence the cleanup.
>
> The first change enhances ehcleanup so as to remove this kind of cleanups on
> its own, without the need to wait for pass_fold_builtins.
>
>
>  2. The introduction of MEM_REF has disabled vectorization for parameters
> passed by reference in Ada.  This used to work because dr_analyze_innermost
> was always building a pointer via build_fold_addr_expr; now, if the base is a
> MEM_REF, it can just take the first operand, which is a reference and not a
> pointer for a parameter passed by reference in Ada.  And simple_iv, unlike
> other functions in tree-scalar-evolution.c, accepts only pointer types:
>
>  type = TREE_TYPE (op);
>  if (TREE_CODE (type) != INTEGER_TYPE
>      && TREE_CODE (type) != POINTER_TYPE)
>    return false;
>
> The second change makes simple_iv use the same test as the other functions in
> tree-scalar-evolution.c.
>
>
> Bootstrapped/regtested on x86_64-suse-linux, OK for mainline?

Use gimple_call_builtin_p (stmt, BUILT_IN_STACK_RESTORE) instead
of re-inventing it with is_gimple_stack_restore.

Otherwise ok.

Thanks,
Richard.

>
>
> 2011-09-24  Eric Botcazou  <ebotca...@adacore.com>
>
>        * tree-eh.c (is_gimple_stack_restore): New predicate.
>        (cleanup_empty_eh): Allow a call to __builtin_stack_restore if there
>        is no outgoing edge.
>
>        * tree-scalar-evolution.c (simple_iv): Accept all pointer and integral
>        types.
>
>
> --
> Eric Botcazou
>

Reply via email to