(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
counts-1.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -fdump-tree-optimized" } */
       3  void unlikely () __attribute__ ((cold));
       4  void unlikely2 () __attribute__ ((cold));
       5  
       6  __attribute__ ((noinline)) void
       7  i_am_also_unlikely (int a)
       8  {
       9    if (a)
      10      unlikely ();
      11    else
      12      unlikely2 ();
      13  }
      14  
      15  
      16  void
      17  i_am_also_unlikely2 (int a,int b)
      18  {
      19    if (b)
      20      i_am_also_unlikely (a);
      21    else
      22      unlikely ();
      23  }
      24  
      25  void
      26  i_am_not_unlikely (int a,int b,int c)
      27  {
      28    if (c)
      29      __builtin_exit (0);
      30    i_am_also_unlikely2 (a,b);
      31  }
      32  /* Detect i_am_also_unlikely i_am_also_unlikely2 as unlikely.  */
      33  /* { dg-final { scan-tree-dump "i_am_also_unlikely\[^\r\n\]*(unlikely executed)" "optimized"} } */
      34  /* { dg-final { scan-tree-dump "i_am_also_unlikely2\[^\r\n\]*(unlikely executed)" "optimized"} } */
      35  /* { dg-final { scan-tree-dump-not "i_am_not_unlikely\[^\r\n\]*(unlikely executed)" "optimized"} } */