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

Feng Xue OS fxue@os.amperecomputing.com
Mon Jan 27 09:57:00 GMT 2020


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-missed-IPA-CP-on-by-ref-argument-directly-passed.patch
Type: application/octet-stream
Size: 4172 bytes
Desc:  0001-Fix-missed-IPA-CP-on-by-ref-argument-directly-passed.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20200127/d639fbf8/attachment.obj>


More information about the Gcc-patches mailing list