1 ; RUN: llc < %s -mtriple=armv4t-unknown-linux-gnueabi | FileCheck %s
6 %1 = type { ptr, ptr, ptr }
7 %"class.llvm::Record" = type { i32, %"class.std::basic_string", %"class.llvm::SMLoc", %"class.std::vector", %"class.std::vector", %"class.std::vector" }
8 %"class.llvm::RecordVal" = type { %"class.std::basic_string", ptr, i32, ptr }
9 %"class.llvm::SMLoc" = type { ptr }
10 %"class.llvm::StringInit" = type { [8 x i8], %"class.std::basic_string" }
11 %"class.std::basic_string" = type { %"class.llvm::SMLoc" }
12 %"class.std::vector" = type { [12 x i8] }
13 %"struct.llvm::Init" = type { ptr }
15 @_ZTIN4llvm5RecTyE = external constant %0 ; <ptr> [#uses=1]
16 @_ZTIN4llvm4InitE = external constant %0 ; <ptr> [#uses=1]
17 @_ZTIN4llvm11RecordRecTyE = external constant %1 ; <ptr> [#uses=1]
18 @.str8 = external constant [47 x i8] ; <ptr> [#uses=1]
19 @_ZTIN4llvm9UnsetInitE = external constant %1 ; <ptr> [#uses=1]
20 @.str51 = external constant [45 x i8] ; <ptr> [#uses=1]
21 @__PRETTY_FUNCTION__._ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs = external constant [116 x i8] ; <ptr> [#uses=1]
23 @_ZN4llvm9RecordValC1ERKSsPNS_5RecTyEj = alias void (ptr, ptr, ptr, i32), ptr @_ZN4llvm9RecordValC2ERKSsPNS_5RecTyEj ; <ptr> [#uses=0]
25 declare ptr @__dynamic_cast(ptr, ptr, ptr, i32)
27 declare void @__assert_fail(ptr, ptr, i32, ptr) noreturn
29 declare void @_ZN4llvm9RecordValC2ERKSsPNS_5RecTyEj(ptr, ptr, ptr, i32) align 2
31 define ptr @_ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs(ptr %this, ptr %R, ptr %RV, ptr %FieldName) align 2 {
32 ;CHECK: ldmia sp!, {r4, r5, r6, r7, r8, lr}
33 ;CHECK: bx r12 @ TAILCALL
35 %.loc = alloca i32 ; <ptr> [#uses=2]
36 %tmp.i = getelementptr inbounds %"class.llvm::StringInit", ptr %this, i32 0, i32 0, i32 4 ; <ptr> [#uses=1]
37 %tmp2.i = load ptr, ptr %tmp.i ; <ptr> [#uses=2]
38 %0 = icmp eq ptr %tmp2.i, null ; <i1> [#uses=1]
39 br i1 %0, label %entry.return_crit_edge, label %tmpbb
41 entry.return_crit_edge: ; preds = %entry
44 tmpbb: ; preds = %entry
45 %1 = tail call ptr @__dynamic_cast(ptr %tmp2.i, ptr @_ZTIN4llvm5RecTyE, ptr @_ZTIN4llvm11RecordRecTyE, i32 -1) ; <ptr> [#uses=1]
46 %phitmp = icmp eq ptr %1, null ; <i1> [#uses=1]
47 br i1 %phitmp, label %.return_crit_edge, label %if.then
49 .return_crit_edge: ; preds = %tmpbb
52 if.then: ; preds = %tmpbb
53 %tmp2.i.i.i.i = getelementptr inbounds %"class.llvm::StringInit", ptr %this, i32 0, i32 1, i32 0, i32 0 ; <ptr> [#uses=1]
54 %tmp3.i.i.i.i = load ptr, ptr %tmp2.i.i.i.i ; <ptr> [#uses=2]
55 %arrayidx.i.i.i.i = getelementptr inbounds i8, ptr %tmp3.i.i.i.i, i32 -12 ; <ptr> [#uses=1]
56 %tmp2.i.i.i = load i32, ptr %arrayidx.i.i.i.i ; <i32> [#uses=1]
57 %tmp.i5 = getelementptr inbounds %"class.llvm::Record", ptr %R, i32 0, i32 4 ; <ptr> [#uses=1]
58 %tmp2.i.i = getelementptr inbounds %"class.llvm::Record", ptr %R, i32 0, i32 4, i32 0, i32 4 ; <ptr> [#uses=1]
59 %tmp3.i.i6 = load ptr, ptr %tmp2.i.i ; <ptr> [#uses=1]
60 %tmp6.i.i = load ptr, ptr %tmp.i5 ; <ptr> [#uses=5]
61 %sub.ptr.lhs.cast.i.i = ptrtoint ptr %tmp3.i.i6 to i32 ; <i32> [#uses=1]
62 %sub.ptr.rhs.cast.i.i = ptrtoint ptr %tmp6.i.i to i32 ; <i32> [#uses=1]
63 %sub.ptr.sub.i.i = sub i32 %sub.ptr.lhs.cast.i.i, %sub.ptr.rhs.cast.i.i ; <i32> [#uses=1]
64 %sub.ptr.div.i.i = ashr i32 %sub.ptr.sub.i.i, 4 ; <i32> [#uses=1]
67 codeRepl: ; preds = %if.then
68 %targetBlock = call i1 @_ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs_for.cond.i(i32 %sub.ptr.div.i.i, ptr %tmp6.i.i, i32 %tmp2.i.i.i, ptr %tmp3.i.i.i.i, ptr %.loc) ; <i1> [#uses=1]
69 %.reload = load i32, ptr %.loc ; <i32> [#uses=3]
70 br i1 %targetBlock, label %for.cond.i.return_crit_edge, label %_ZN4llvm6Record8getValueENS_9StringRefE.exit
72 for.cond.i.return_crit_edge: ; preds = %codeRepl
75 _ZN4llvm6Record8getValueENS_9StringRefE.exit: ; preds = %codeRepl
76 %add.ptr.i.i = getelementptr inbounds %"class.llvm::RecordVal", ptr %tmp6.i.i, i32 %.reload ; <ptr> [#uses=2]
77 %tobool5 = icmp eq ptr %add.ptr.i.i, null ; <i1> [#uses=1]
78 br i1 %tobool5, label %_ZN4llvm6Record8getValueENS_9StringRefE.exit.return_crit_edge, label %if.then6
80 _ZN4llvm6Record8getValueENS_9StringRefE.exit.return_crit_edge: ; preds = %_ZN4llvm6Record8getValueENS_9StringRefE.exit
83 if.then6: ; preds = %_ZN4llvm6Record8getValueENS_9StringRefE.exit
84 %cmp = icmp eq ptr %add.ptr.i.i, %RV ; <i1> [#uses=1]
85 br i1 %cmp, label %if.then6.if.end_crit_edge, label %land.lhs.true
87 if.then6.if.end_crit_edge: ; preds = %if.then6
90 land.lhs.true: ; preds = %if.then6
91 %tobool10 = icmp eq ptr %RV, null ; <i1> [#uses=1]
92 br i1 %tobool10, label %lor.lhs.false, label %land.lhs.true.return_crit_edge
94 land.lhs.true.return_crit_edge: ; preds = %land.lhs.true
97 lor.lhs.false: ; preds = %land.lhs.true
98 %tmp.i3 = getelementptr inbounds %"class.llvm::RecordVal", ptr %tmp6.i.i, i32 %.reload, i32 3 ; <ptr> [#uses=1]
99 %tmp2.i4 = load ptr, ptr %tmp.i3 ; <ptr> [#uses=2]
100 %2 = icmp eq ptr %tmp2.i4, null ; <i1> [#uses=1]
101 br i1 %2, label %lor.lhs.false.if.end_crit_edge, label %tmpbb1
103 lor.lhs.false.if.end_crit_edge: ; preds = %lor.lhs.false
106 tmpbb1: ; preds = %lor.lhs.false
107 %3 = tail call ptr @__dynamic_cast(ptr %tmp2.i4, ptr @_ZTIN4llvm4InitE, ptr @_ZTIN4llvm9UnsetInitE, i32 -1) ; <ptr> [#uses=1]
108 %phitmp32 = icmp eq ptr %3, null ; <i1> [#uses=1]
109 br i1 %phitmp32, label %.if.end_crit_edge, label %.return_crit_edge1
111 .return_crit_edge1: ; preds = %tmpbb1
114 .if.end_crit_edge: ; preds = %tmpbb1
117 if.end: ; preds = %.if.end_crit_edge, %lor.lhs.false.if.end_crit_edge, %if.then6.if.end_crit_edge
118 %tmp.i1 = getelementptr inbounds %"class.llvm::RecordVal", ptr %tmp6.i.i, i32 %.reload, i32 3 ; <ptr> [#uses=1]
119 %tmp2.i2 = load ptr, ptr %tmp.i1 ; <ptr> [#uses=3]
120 %cmp19 = icmp eq ptr %tmp2.i2, %this ; <i1> [#uses=1]
121 br i1 %cmp19, label %cond.false, label %cond.end
123 cond.false: ; preds = %if.end
124 tail call void @__assert_fail(ptr @.str51, ptr @.str8, i32 1141, ptr @__PRETTY_FUNCTION__._ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs) noreturn
127 cond.end: ; preds = %if.end
128 %4 = load ptr, ptr %tmp2.i2 ; <ptr> [#uses=1]
129 %vfn = getelementptr inbounds ptr, ptr %4, i32 8 ; <ptr> [#uses=1]
130 %5 = load ptr, ptr %vfn ; <ptr> [#uses=1]
131 %call25 = tail call ptr %5(ptr %tmp2.i2, ptr %R, ptr %RV, ptr %FieldName) ; <ptr> [#uses=1]
134 return: ; preds = %.return_crit_edge1, %land.lhs.true.return_crit_edge, %_ZN4llvm6Record8getValueENS_9StringRefE.exit.return_crit_edge, %for.cond.i.return_crit_edge, %.return_crit_edge, %entry.return_crit_edge
138 declare i1 @_ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs_for.cond.i(i32, ptr, i32, ptr, ptr)