1  /* { dg-require-effective-target freorder } */
       2  /* { dg-options "-O2 -freorder-blocks-and-partition -fschedule-insns -fselective-scheduling" { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
       3  
       4  extern void abort (void);
       5  
       6  int ifelse_val2;
       7  
       8  int __attribute__((noinline))
       9  test_ifelse2 (int i)
      10  {
      11    int result = 0;
      12    if (!i)				/* count(6) */
      13      result = 1;				/* count(1) */
      14    if (i == 1)				/* count(6) */
      15      result = 1024;
      16    if (i == 2)				/* count(6) */
      17      result = 2;				/* count(3) */
      18    if (i == 3)				/* count(6) */
      19      return 8;				/* count(2) */
      20    if (i == 4)				/* count(4) */
      21      return 2048;
      22    return result;			/* count(4) */
      23  }
      24  
      25  void __attribute__((noinline))
      26  call_ifelse ()
      27  {
      28    ifelse_val2 += test_ifelse2 (0);
      29    ifelse_val2 += test_ifelse2 (2);
      30    ifelse_val2 += test_ifelse2 (2);
      31    ifelse_val2 += test_ifelse2 (2);
      32    ifelse_val2 += test_ifelse2 (3);
      33    ifelse_val2 += test_ifelse2 (3);
      34  }
      35  
      36  int
      37  main()
      38  {
      39    call_ifelse ();
      40    if (ifelse_val2 != 23)
      41      abort ();
      42    return 0;
      43  }