1 ; RUN: llc < %s -march=thumb
2 ; RUN: llc < %s -mtriple=thumb-apple-darwin -relocation-model=pic \
3 ; RUN: -mattr=+v6,+vfp2 | not grep {add r., r7, #2 \\* 4}
5 %struct.__fooAllocator = type opaque
6 %struct.__fooY = type { %struct.fooXBase, %struct.__fooString*, %struct.__fooU*, %struct.__fooV*, i8** }
7 %struct.__fooZ = type opaque
8 %struct.__fooU = type opaque
9 %struct.__fooString = type opaque
10 %struct.__fooV = type opaque
11 %struct.fooXBase = type { i32, [4 x i8] }
12 %struct.fooXClass = type { i32, i8*, void (i8*)*, i8* (%struct.__fooAllocator*, i8*)*, void (i8*)*, i8 (i8*, i8*) zeroext *, i32 (i8*)*, %struct.__fooString* (i8*, %struct.__fooZ*)*, %struct.__fooString* (i8*)* }
13 %struct.aa_cache = type { i32, i32, [1 x %struct.aa_method*] }
14 %struct.aa_class = type { %struct.aa_class*, %struct.aa_class*, i8*, i32, i32, i32, %struct.aa_ivar_list*, %struct.aa_method_list**, %struct.aa_cache*, %struct.aa_protocol_list* }
15 %struct.aa_ivar = type { i8*, i8*, i32 }
16 %struct.aa_ivar_list = type { i32, [1 x %struct.aa_ivar] }
17 %struct.aa_method = type { %struct.aa_ss*, i8*, %struct.aa_object* (%struct.aa_object*, %struct.aa_ss*, ...)* }
18 %struct.aa_method_list = type { %struct.aa_method_list*, i32, [1 x %struct.aa_method] }
19 %struct.aa_object = type { %struct.aa_class* }
20 %struct.aa_protocol_list = type { %struct.aa_protocol_list*, i32, [1 x %struct.aa_object*] }
21 %struct.aa_ss = type opaque
22 @__kfooYTypeID = external global i32 ; <i32*> [#uses=3]
23 @__fooYClass = external constant %struct.fooXClass ; <%struct.fooXClass*> [#uses=1]
24 @__fooXClassTableSize = external global i32 ; <i32*> [#uses=1]
25 @__fooXAaClassTable = external global i32* ; <i32**> [#uses=1]
26 @s.10319 = external global %struct.aa_ss* ; <%struct.aa_ss**> [#uses=2]
27 @str15 = external constant [24 x i8] ; <[24 x i8]*> [#uses=1]
30 define i8 @test(%struct.__fooY* %calendar, double* %atp, i8* %componentDesc, ...) zeroext {
32 %args = alloca i8*, align 4 ; <i8**> [#uses=5]
33 %args4 = bitcast i8** %args to i8* ; <i8*> [#uses=2]
34 call void @llvm.va_start( i8* %args4 )
35 %tmp6 = load i32* @__kfooYTypeID ; <i32> [#uses=1]
36 icmp eq i32 %tmp6, 0 ; <i1>:0 [#uses=1]
37 br i1 %0, label %cond_true, label %cond_next
39 cond_true: ; preds = %entry
40 %tmp7 = call i32 @_fooXRegisterClass( %struct.fooXClass* @__fooYClass ) ; <i32> [#uses=1]
41 store i32 %tmp7, i32* @__kfooYTypeID
44 cond_next: ; preds = %cond_true, %entry
45 %tmp8 = load i32* @__kfooYTypeID ; <i32> [#uses=2]
46 %tmp15 = load i32* @__fooXClassTableSize ; <i32> [#uses=1]
47 icmp ugt i32 %tmp15, %tmp8 ; <i1>:1 [#uses=1]
48 br i1 %1, label %cond_next18, label %cond_true58
50 cond_next18: ; preds = %cond_next
51 %tmp21 = getelementptr %struct.__fooY* %calendar, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
52 %tmp22 = load i32* %tmp21 ; <i32> [#uses=2]
53 %tmp29 = load i32** @__fooXAaClassTable ; <i32*> [#uses=1]
54 %tmp31 = getelementptr i32* %tmp29, i32 %tmp8 ; <i32*> [#uses=1]
55 %tmp32 = load i32* %tmp31 ; <i32> [#uses=1]
56 icmp eq i32 %tmp22, %tmp32 ; <i1>:2 [#uses=1]
57 %.not = xor i1 %2, true ; <i1> [#uses=1]
58 icmp ugt i32 %tmp22, 4095 ; <i1>:3 [#uses=1]
59 %bothcond = and i1 %.not, %3 ; <i1> [#uses=1]
60 br i1 %bothcond, label %cond_true58, label %bb48
62 bb48: ; preds = %cond_next18
63 %tmp78 = call i32 @strlen( i8* %componentDesc ) ; <i32> [#uses=4]
64 %tmp92 = alloca i32, i32 %tmp78 ; <i32*> [#uses=2]
65 icmp sgt i32 %tmp78, 0 ; <i1>:4 [#uses=1]
66 br i1 %4, label %cond_true111, label %bb114
68 cond_true58: ; preds = %cond_next18, %cond_next
69 %tmp59 = load %struct.aa_ss** @s.10319 ; <%struct.aa_ss*> [#uses=2]
70 icmp eq %struct.aa_ss* %tmp59, null ; <i1>:5 [#uses=1]
71 %tmp6869 = bitcast %struct.__fooY* %calendar to i8* ; <i8*> [#uses=2]
72 br i1 %5, label %cond_true60, label %cond_next64
74 cond_true60: ; preds = %cond_true58
75 %tmp63 = call %struct.aa_ss* @sel_registerName( i8* getelementptr ([24 x i8]* @str15, i32 0, i32 0) ) ; <%struct.aa_ss*> [#uses=2]
76 store %struct.aa_ss* %tmp63, %struct.aa_ss** @s.10319
77 %tmp66137 = volatile load i8** %args ; <i8*> [#uses=1]
78 %tmp73138 = call i8 (i8*, %struct.aa_ss*, ...) zeroext * bitcast (%struct.aa_object* (%struct.aa_object*, %struct.aa_ss*, ...)* @aa_mm to i8 (i8*, %struct.aa_ss*, ...) zeroext *)( i8* %tmp6869, %struct.aa_ss* %tmp63, double* %atp, i8* %componentDesc, i8* %tmp66137) zeroext ; <i8> [#uses=1]
81 cond_next64: ; preds = %cond_true58
82 %tmp66 = volatile load i8** %args ; <i8*> [#uses=1]
83 %tmp73 = call i8 (i8*, %struct.aa_ss*, ...) zeroext * bitcast (%struct.aa_object* (%struct.aa_object*, %struct.aa_ss*, ...)* @aa_mm to i8 (i8*, %struct.aa_ss*, ...) zeroext *)( i8* %tmp6869, %struct.aa_ss* %tmp59, double* %atp, i8* %componentDesc, i8* %tmp66 ) zeroext ; <i8> [#uses=1]
86 cond_true111: ; preds = %cond_true111, %bb48
87 %idx.2132.0 = phi i32 [ 0, %bb48 ], [ %indvar.next, %cond_true111 ] ; <i32> [#uses=2]
88 %tmp95 = volatile load i8** %args ; <i8*> [#uses=2]
89 %tmp97 = getelementptr i8* %tmp95, i32 4 ; <i8*> [#uses=1]
90 volatile store i8* %tmp97, i8** %args
91 %tmp9899 = bitcast i8* %tmp95 to i32* ; <i32*> [#uses=1]
92 %tmp100 = load i32* %tmp9899 ; <i32> [#uses=1]
93 %tmp104 = getelementptr i32* %tmp92, i32 %idx.2132.0 ; <i32*> [#uses=1]
94 store i32 %tmp100, i32* %tmp104
95 %indvar.next = add i32 %idx.2132.0, 1 ; <i32> [#uses=2]
96 icmp eq i32 %indvar.next, %tmp78 ; <i1>:6 [#uses=1]
97 br i1 %6, label %bb114, label %cond_true111
99 bb114: ; preds = %cond_true111, %bb48
100 call void @llvm.va_end( i8* %args4 )
101 %tmp122 = call i8 @_fooYCCV( %struct.__fooY* %calendar, double* %atp, i8* %componentDesc, i32* %tmp92, i32 %tmp78 ) zeroext ; <i8> [#uses=1]
105 declare i32 @_fooXRegisterClass(%struct.fooXClass*)
107 declare i8 @_fooYCCV(%struct.__fooY*, double*, i8*, i32*, i32) zeroext
109 declare %struct.aa_object* @aa_mm(%struct.aa_object*, %struct.aa_ss*, ...)
111 declare %struct.aa_ss* @sel_registerName(i8*)
113 declare void @llvm.va_start(i8*)
115 declare i32 @strlen(i8*)
117 declare void @llvm.va_end(i8*)