1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -fno-ipa-icf -fdump-tree-optimized" } */
       3  
       4  int f(int y, int x)
       5  {
       6    int a = x | y;
       7    return a & x;
       8  }
       9  int f1(int y, int x)
      10  {
      11    int a = y | x;
      12    return a & x;
      13  }
      14  int f2(int y, int x)
      15  {
      16    int a = x | y;
      17    return x & a;
      18  }
      19  int f3(int y, int x)
      20  {
      21    int a = x | y;
      22    return x & a;
      23  }
      24  int f4(int y, int x)
      25  {
      26    int a = x & y;
      27    return a | x;
      28  }
      29  int f5(int y, int x)
      30  {
      31    int a = y & x;
      32    return a | x;
      33  }
      34  int f6(int y, int x)
      35  {
      36    int a = x & y;
      37    return x | a;
      38  }
      39  int f7(int y, int x)
      40  {
      41    int a = x & y;
      42    return x | a;
      43  }
      44  /* These all should be optimized to just return x; */
      45  
      46  
      47  /* { dg-final { scan-tree-dump-times "\\\|" 0 "optimized" } } */
      48  /* { dg-final { scan-tree-dump-times "\&" 0 "optimized" } } */
      49  /* { dg-final { scan-tree-dump-times "return x_..D.;" 8 "optimized" } } */