1 // { dg-do compile }
2 // { dg-options "-O -fdump-tree-cddce1" }
3
4 enum Scale { E1, E2, E3, E4, E5, E6, E7, E8 };
5
Test(Scale s)6 int Test(Scale s)
7 {
8 switch(s)
9 {
10 case E1: return 12;
11 case E2: return 17;
12 case E3: return 22;
13 case E4: return 42;
14 default: break;
15 }
16 return 0;
17 }
18
19 // tree forwprop should have eliminated the (int) s cast for the
20 // switch value and directly switch on the 's' parameter
21
22 // { dg-final { scan-tree-dump-not "\\\(int\\\)" "cddce1" } }
23 // { dg-final { scan-tree-dump "switch \\\(s_.\\\(D\\\)\\\)" "cddce1" } }
24