re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr19431.c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
4 /* We want this optimized as
5 <bb 2>:
6 if (k != 0) goto <L2>; else goto <L3>;
7
8 <L3>:;
9 i1 = j1;
10
11 <L2>:;
12 return i1;
13
14 This requires that i1 and j1 are changed into registers after they
15 no longer have their address taken. */
16
17 int f(int k, int i1, int j1)
18 {
19 int *f1;
20 if(k)
21 f1 = &i1;
22 else
23 f1 = &j1;
24 return *f1;
25 }
26
27 /* { dg-final { scan-tree-dump "i1 = j1" "optimized" } } */
28 /* { dg-final { scan-tree-dump "return i1;" "optimized" } } */
29 /* { dg-final { cleanup-tree-dump "optimized" } } */