(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
ipa/
ipcp-agg-4.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim"  } */
       3  /* { dg-add-options bind_pic_locally } */
       4  
       5  struct S
       6  {
       7    int a, b, c;
       8  };
       9  
      10  void *blah(int, void *);
      11  
      12  static void __attribute__ ((noinline))
      13  foo (struct S *p)
      14  {
      15    int i, c = p->c;
      16    int b = p->b;
      17    void *v = (void *) p;
      18  
      19    for (i= 0; i< c; i++)
      20      v = blah(b + i, v);
      21  }
      22  
      23  
      24  void
      25  entry1 (int c)
      26  {
      27    struct S s;
      28    int i;
      29  
      30    for (i = 0; i<c; i++)
      31      {
      32        s.a = 1;
      33        s.b = 64;
      34        s.c = 32;
      35        foo (&s);
      36      }
      37    s.c = 2;
      38    foo (&s);
      39  }
      40  
      41  void
      42  entry2 (int c)
      43  {
      44    struct S s;
      45    int i;
      46  
      47    for (i = 0; i<c; i++)
      48      {
      49        s.a = 6;
      50        s.b = 64;
      51        s.c = 32;
      52        foo (&s);
      53      }
      54    s.c = 2;
      55    foo (&s);
      56  }
      57  
      58  /* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo/\[0-9\]*\\." 2 "cp" } } */
      59  /* { dg-final { scan-ipa-dump-times "Aggregate replacements:" 4 "cp" } } */
      60  /* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */