[PATCH] Fix missed IPA-CP on by-ref argument directly passed through (PR ipa/93429)

Jeff Law law@redhat.com
Mon Jan 27 17:40:00 GMT 2020


On Mon, 2020-01-27 at 04:53 +0000, Feng Xue OS wrote:
> Current IPA does not propagate aggregate constant for by-ref argument
> if it is simple pass-through of caller parameter. Here is an example,
> 
>    f1 (int *p)
>    {
>      ... = *p;
>      ...
>    }
> 
>    f2 (int *p)
>    {
>       *p = 2;
>       f1 (p);
>    }
> 
> It is easy to know that in f1(), *p should be 2 after a simple propagation
> from f2() to f1(). But this is missed due to some bug, which is targeted
> by this patch.
> 
> Bootstrapped/regtested on x86_64-linux and aarch64-linux.
> 
> Feng
> ---
> 2020-01-27  Feng Xue  <fxue@os.amperecomputing.com>
> 
>         PR ipa/93429
>         * ipa-cp.c (propagate_aggs_across_jump_function): Further
>         check aggregate jump functions if by-ref argument is simple
>         pass through.
>         (intersect_aggregates_with_edge): Likewise.
I'm deferring this to gcc-11 as it's a missed-optimization and we're in
stage4.

jeff



More information about the Gcc-patches mailing list