R600: Make sure to inline all internal functions
[oota-llvm.git] / test / Transforms / GVN / pr17852.ll
1 ; RUN: opt < %s -basicaa -gvn
2 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
3 %struct.S0 = type { [2 x i8], [2 x i8], [4 x i8], [2 x i8], i32, i32, i32, i32 }
4 define void @fn1(%struct.S0* byval align 8 %p1) {
5   br label %for.cond
6 for.cond:                                         ; preds = %1, %0
7   br label %for.end
8   %f2 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 2
9   %f9 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 7
10   br label %for.cond
11 for.end:                                          ; preds = %for.cond
12   br i1 true, label %if.else, label %if.then
13 if.then:                                          ; preds = %for.end
14   %f22 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 2
15   %f7 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 5
16   %tmp7 = load i32* %f7, align 8
17   br label %if.end40
18 if.else:                                          ; preds = %for.end
19   br i1 false, label %for.cond18, label %if.then6
20 if.then6:                                         ; preds = %if.else
21   %f3 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 2
22   %tmp10 = bitcast %struct.S0* %p1 to i16*
23   %f5 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 3
24   %tmp11 = bitcast [2 x i8]* %f5 to i16*
25   %bf.load13 = load i16* %tmp11, align 8
26   br label %if.end36
27 for.cond18:                                       ; preds = %if.else
28   call void @fn4()
29   br i1 true, label %if.end, label %if.end36
30 if.end:                                           ; preds = %for.cond18
31   %f321 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 2
32   %f925 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 7
33   %f526 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 3
34   %tmp15 = bitcast [2 x i8]* %f526 to i16*
35   %bf.load27 = load i16* %tmp15, align 8
36   %tmp16 = bitcast %struct.S0* %p1 to i16*
37   br label %if.end36
38 if.end36:                                         ; preds = %if.end, %for.cond18, %if.then6
39   %f537 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 3
40   %tmp17 = bitcast [2 x i8]* %f537 to i16*
41   %bf.load38 = load i16* %tmp17, align 8
42   %bf.clear39 = and i16 %bf.load38, -16384
43   br label %if.end40
44 if.end40:                                         ; preds = %if.end36, %if.then
45   %f6 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 4
46   %tmp18 = load i32* %f6, align 4
47   call void @fn2(i32 %tmp18)
48   %f8 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 6
49   %tmp19 = load i32* %f8, align 4
50   %tobool41 = icmp eq i32 %tmp19, 0
51   br i1 true, label %if.end50, label %if.then42
52 if.then42:                                        ; preds = %if.end40
53   %tmp20 = bitcast %struct.S0* %p1 to i16*
54   %f547 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 3
55   %tmp21 = bitcast [2 x i8]* %f547 to i16*
56   %bf.load48 = load i16* %tmp21, align 8
57   br label %if.end50
58 if.end50:                                         ; preds = %if.then42, %if.end40
59   %f551 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 3
60   %tmp22 = bitcast [2 x i8]* %f551 to i16*
61   %bf.load52 = load i16* %tmp22, align 8
62   %bf.clear53 = and i16 %bf.load52, -16384
63   ret void
64 }
65 declare void @fn2(i32)
66 declare void @fn4()