(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
ipa/
ipa-sra-14.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O2 -fipa-sra -fdump-ipa-sra"  } */
       3  
       4  /* Check of a transitive recursive structure split. */
       5  
       6  struct S
       7  {
       8    float red;
       9    void *blue;
      10    int green;
      11  };
      12  
      13  
      14  static int done = 0;
      15  
      16  void __attribute__((noipa))
      17  check (float r, int g, int g2)
      18  {
      19    if (r < 7.39 || r > 7.41
      20        || g != 6 || g2 != 6)
      21      __builtin_abort ();
      22  }
      23  
      24  static void __attribute__((noinline)) bar (struct S s);
      25  
      26  static void
      27  __attribute__((noinline))
      28  foo (struct S s)
      29  {
      30    if (!done)
      31      {
      32        done = 1;
      33        bar (s);
      34      }
      35    check (s.red, s.green, s.green);
      36  }
      37  
      38  static void
      39  __attribute__((noinline))
      40  bar (struct S s)
      41  {
      42    foo (s);
      43  }
      44  
      45  int
      46  main (int argc, char **argv)
      47  {
      48    struct S s;
      49  
      50    s.red = 7.4;
      51    s.green = 6;
      52    s.blue = &s;
      53  
      54    bar (s);
      55    return 0;
      56  }
      57  
      58  
      59  /* { dg-final { scan-ipa-dump-times "Will split parameter" 2 "sra" { xfail { hpp
      60  a*-*-hpux* && { ! lp64 } } } } } */
      61  /* { dg-final { scan-ipa-dump-times "component at byte offset" 4 "sra" { xfail { hpp
      62  a*-*-hpux* && { ! lp64 } } } } } */