1 ; RUN: llc < %s -march=arm -mtriple=armv4t-unknown-linux-gnueabi | FileCheck %s 2 ; PR 7433 3 ; XFAIL: * 4 5 %0 = type { i8*, i8* } 6 %1 = type { i8*, i8*, i8* } 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", %"struct.llvm::Init"*, i32, %"struct.llvm::Init"* } 9 %"class.llvm::SMLoc" = type { i8* } 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 { i32 (...)** } 14 15 @_ZTIN4llvm5RecTyE = external constant %0 ; <%0*> [#uses=1] 16 @_ZTIN4llvm4InitE = external constant %0 ; <%0*> [#uses=1] 17 @_ZTIN4llvm11RecordRecTyE = external constant %1 ; <%1*> [#uses=1] 18 @.str8 = external constant [47 x i8] ; <[47 x i8]*> [#uses=1] 19 @_ZTIN4llvm9UnsetInitE = external constant %1 ; <%1*> [#uses=1] 20 @.str51 = external constant [45 x i8] ; <[45 x i8]*> [#uses=1] 21 @__PRETTY_FUNCTION__._ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs = external constant [116 x i8] ; <[116 x i8]*> [#uses=1] 22 23 @_ZN4llvm9RecordValC1ERKSsPNS_5RecTyEj = alias void (%"class.llvm::RecordVal"*, %"class.std::basic_string"*, %"struct.llvm::Init"*, i32)* @_ZN4llvm9RecordValC2ERKSsPNS_5RecTyEj ; <void (%"class.llvm::RecordVal"*, %"class.std::basic_string"*, %"struct.llvm::Init"*, i32)*> [#uses=0] 24 25 declare i8* @__dynamic_cast(i8*, i8*, i8*, i32) 26 27 declare void @__assert_fail(i8*, i8*, i32, i8*) noreturn 28 29 declare void @_ZN4llvm9RecordValC2ERKSsPNS_5RecTyEj(%"class.llvm::RecordVal"*, %"class.std::basic_string"*, %"struct.llvm::Init"*, i32) align 2 30 31 define %"struct.llvm::Init"* @_ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs(%"class.llvm::StringInit"* %this, %"class.llvm::Record"* %R, %"class.llvm::RecordVal"* %RV, %"class.std::basic_string"* %FieldName) align 2 { 32 ;CHECK: ldmia sp!, {r4, r5, r6, r7, r8, lr} 33 ;CHECK: bx r12 @ TAILCALL 34 entry: 35 %.loc = alloca i32 ; <i32*> [#uses=2] 36 %tmp.i = getelementptr inbounds %"class.llvm::StringInit"* %this, i32 0, i32 0, i32 4 ; <i8*> [#uses=1] 37 %0 = bitcast i8* %tmp.i to %"struct.llvm::Init"** ; <%"struct.llvm::Init"**> [#uses=1] 38 %tmp2.i = load %"struct.llvm::Init"** %0 ; <%"struct.llvm::Init"*> [#uses=2] 39 %1 = icmp eq %"struct.llvm::Init"* %tmp2.i, null ; <i1> [#uses=1] 40 br i1 %1, label %entry.return_crit_edge, label %tmpbb 41 42 entry.return_crit_edge: ; preds = %entry 43 br label %return 44 45 tmpbb: ; preds = %entry 46 %2 = bitcast %"struct.llvm::Init"* %tmp2.i to i8* ; <i8*> [#uses=1] 47 %3 = tail call i8* @__dynamic_cast(i8* %2, i8* bitcast (%0* @_ZTIN4llvm5RecTyE to i8*), i8* bitcast (%1* @_ZTIN4llvm11RecordRecTyE to i8*), i32 -1) ; <i8*> [#uses=1] 48 %phitmp = icmp eq i8* %3, null ; <i1> [#uses=1] 49 br i1 %phitmp, label %.return_crit_edge, label %if.then 50 51 .return_crit_edge: ; preds = %tmpbb 52 br label %return 53 54 if.then: ; preds = %tmpbb 55 %tmp2.i.i.i.i = getelementptr inbounds %"class.llvm::StringInit"* %this, i32 0, i32 1, i32 0, i32 0 ; <i8**> [#uses=1] 56 %tmp3.i.i.i.i = load i8** %tmp2.i.i.i.i ; <i8*> [#uses=2] 57 %arrayidx.i.i.i.i = getelementptr inbounds i8* %tmp3.i.i.i.i, i32 -12 ; <i8*> [#uses=1] 58 %tmp.i.i.i = bitcast i8* %arrayidx.i.i.i.i to i32* ; <i32*> [#uses=1] 59 %tmp2.i.i.i = load i32* %tmp.i.i.i ; <i32> [#uses=1] 60 %tmp.i5 = getelementptr inbounds %"class.llvm::Record"* %R, i32 0, i32 4 ; <%"class.std::vector"*> [#uses=1] 61 %tmp2.i.i = getelementptr inbounds %"class.llvm::Record"* %R, i32 0, i32 4, i32 0, i32 4 ; <i8*> [#uses=1] 62 %4 = bitcast i8* %tmp2.i.i to %"class.llvm::RecordVal"** ; <%"class.llvm::RecordVal"**> [#uses=1] 63 %tmp3.i.i6 = load %"class.llvm::RecordVal"** %4 ; <%"class.llvm::RecordVal"*> [#uses=1] 64 %tmp5.i.i = bitcast %"class.std::vector"* %tmp.i5 to %"class.llvm::RecordVal"** ; <%"class.llvm::RecordVal"**> [#uses=1] 65 %tmp6.i.i = load %"class.llvm::RecordVal"** %tmp5.i.i ; <%"class.llvm::RecordVal"*> [#uses=5] 66 %sub.ptr.lhs.cast.i.i = ptrtoint %"class.llvm::RecordVal"* %tmp3.i.i6 to i32 ; <i32> [#uses=1] 67 %sub.ptr.rhs.cast.i.i = ptrtoint %"class.llvm::RecordVal"* %tmp6.i.i to i32 ; <i32> [#uses=1] 68 %sub.ptr.sub.i.i = sub i32 %sub.ptr.lhs.cast.i.i, %sub.ptr.rhs.cast.i.i ; <i32> [#uses=1] 69 %sub.ptr.div.i.i = ashr i32 %sub.ptr.sub.i.i, 4 ; <i32> [#uses=1] 70 br label %codeRepl 71 72 codeRepl: ; preds = %if.then 73 %targetBlock = call i1 @_ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs_for.cond.i(i32 %sub.ptr.div.i.i, %"class.llvm::RecordVal"* %tmp6.i.i, i32 %tmp2.i.i.i, i8* %tmp3.i.i.i.i, i32* %.loc) ; <i1> [#uses=1] 74 %.reload = load i32* %.loc ; <i32> [#uses=3] 75 br i1 %targetBlock, label %for.cond.i.return_crit_edge, label %_ZN4llvm6Record8getValueENS_9StringRefE.exit 76 77 for.cond.i.return_crit_edge: ; preds = %codeRepl 78 br label %return 79 80 _ZN4llvm6Record8getValueENS_9StringRefE.exit: ; preds = %codeRepl 81 %add.ptr.i.i = getelementptr inbounds %"class.llvm::RecordVal"* %tmp6.i.i, i32 %.reload ; <%"class.llvm::RecordVal"*> [#uses=2] 82 %tobool5 = icmp eq %"class.llvm::RecordVal"* %add.ptr.i.i, null ; <i1> [#uses=1] 83 br i1 %tobool5, label %_ZN4llvm6Record8getValueENS_9StringRefE.exit.return_crit_edge, label %if.then6 84 85 _ZN4llvm6Record8getValueENS_9StringRefE.exit.return_crit_edge: ; preds = %_ZN4llvm6Record8getValueENS_9StringRefE.exit 86 br label %return 87 88 if.then6: ; preds = %_ZN4llvm6Record8getValueENS_9StringRefE.exit 89 %cmp = icmp eq %"class.llvm::RecordVal"* %add.ptr.i.i, %RV ; <i1> [#uses=1] 90 br i1 %cmp, label %if.then6.if.end_crit_edge, label %land.lhs.true 91 92 if.then6.if.end_crit_edge: ; preds = %if.then6 93 br label %if.end 94 95 land.lhs.true: ; preds = %if.then6 96 %tobool10 = icmp eq %"class.llvm::RecordVal"* %RV, null ; <i1> [#uses=1] 97 br i1 %tobool10, label %lor.lhs.false, label %land.lhs.true.return_crit_edge 98 99 land.lhs.true.return_crit_edge: ; preds = %land.lhs.true 100 br label %return 101 102 lor.lhs.false: ; preds = %land.lhs.true 103 %tmp.i3 = getelementptr inbounds %"class.llvm::RecordVal"* %tmp6.i.i, i32 %.reload, i32 3 ; <%"struct.llvm::Init"**> [#uses=1] 104 %tmp2.i4 = load %"struct.llvm::Init"** %tmp.i3 ; <%"struct.llvm::Init"*> [#uses=2] 105 %5 = icmp eq %"struct.llvm::Init"* %tmp2.i4, null ; <i1> [#uses=1] 106 br i1 %5, label %lor.lhs.false.if.end_crit_edge, label %tmpbb1 107 108 lor.lhs.false.if.end_crit_edge: ; preds = %lor.lhs.false 109 br label %if.end 110 111 tmpbb1: ; preds = %lor.lhs.false 112 %6 = bitcast %"struct.llvm::Init"* %tmp2.i4 to i8* ; <i8*> [#uses=1] 113 %7 = tail call i8* @__dynamic_cast(i8* %6, i8* bitcast (%0* @_ZTIN4llvm4InitE to i8*), i8* bitcast (%1* @_ZTIN4llvm9UnsetInitE to i8*), i32 -1) ; <i8*> [#uses=1] 114 %phitmp32 = icmp eq i8* %7, null ; <i1> [#uses=1] 115 br i1 %phitmp32, label %.if.end_crit_edge, label %.return_crit_edge1 116 117 .return_crit_edge1: ; preds = %tmpbb1 118 br label %return 119 120 .if.end_crit_edge: ; preds = %tmpbb1 121 br label %if.end 122 123 if.end: ; preds = %.if.end_crit_edge, %lor.lhs.false.if.end_crit_edge, %if.then6.if.end_crit_edge 124 %tmp.i1 = getelementptr inbounds %"class.llvm::RecordVal"* %tmp6.i.i, i32 %.reload, i32 3 ; <%"struct.llvm::Init"**> [#uses=1] 125 %tmp2.i2 = load %"struct.llvm::Init"** %tmp.i1 ; <%"struct.llvm::Init"*> [#uses=3] 126 %8 = bitcast %"class.llvm::StringInit"* %this to %"struct.llvm::Init"* ; <%"struct.llvm::Init"*> [#uses=1] 127 %cmp19 = icmp eq %"struct.llvm::Init"* %tmp2.i2, %8 ; <i1> [#uses=1] 128 br i1 %cmp19, label %cond.false, label %cond.end 129 130 cond.false: ; preds = %if.end 131 tail call void @__assert_fail(i8* getelementptr inbounds ([45 x i8]* @.str51, i32 0, i32 0), i8* getelementptr inbounds ([47 x i8]* @.str8, i32 0, i32 0), i32 1141, i8* getelementptr inbounds ([116 x i8]* @__PRETTY_FUNCTION__._ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs, i32 0, i32 0)) noreturn 132 unreachable 133 134 cond.end: ; preds = %if.end 135 %9 = bitcast %"struct.llvm::Init"* %tmp2.i2 to %"struct.llvm::Init"* (%"struct.llvm::Init"*, %"class.llvm::Record"*, %"class.llvm::RecordVal"*, %"class.std::basic_string"*)*** ; <%"struct.llvm::Init"* (%"struct.llvm::Init"*, %"class.llvm::Record"*, %"class.llvm::RecordVal"*, %"class.std::basic_string"*)***> [#uses=1] 136 %10 = load %"struct.llvm::Init"* (%"struct.llvm::Init"*, %"class.llvm::Record"*, %"class.llvm::RecordVal"*, %"class.std::basic_string"*)*** %9 ; <%"struct.llvm::Init"* (%"struct.llvm::Init"*, %"class.llvm::Record"*, %"class.llvm::RecordVal"*, %"class.std::basic_string"*)**> [#uses=1] 137 %vfn = getelementptr inbounds %"struct.llvm::Init"* (%"struct.llvm::Init"*, %"class.llvm::Record"*, %"class.llvm::RecordVal"*, %"class.std::basic_string"*)** %10, i32 8 ; <%"struct.llvm::Init"* (%"struct.llvm::Init"*, %"class.llvm::Record"*, %"class.llvm::RecordVal"*, %"class.std::basic_string"*)**> [#uses=1] 138 %11 = load %"struct.llvm::Init"* (%"struct.llvm::Init"*, %"class.llvm::Record"*, %"class.llvm::RecordVal"*, %"class.std::basic_string"*)** %vfn ; <%"struct.llvm::Init"* (%"struct.llvm::Init"*, %"class.llvm::Record"*, %"class.llvm::RecordVal"*, %"class.std::basic_string"*)*> [#uses=1] 139 %call25 = tail call %"struct.llvm::Init"* %11(%"struct.llvm::Init"* %tmp2.i2, %"class.llvm::Record"* %R, %"class.llvm::RecordVal"* %RV, %"class.std::basic_string"* %FieldName) ; <%"struct.llvm::Init"*> [#uses=1] 140 ret %"struct.llvm::Init"* %call25 141 142 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 143 ret %"struct.llvm::Init"* null 144 } 145 146 declare i1 @_ZNK4llvm7VarInit12getFieldInitERNS_6RecordEPKNS_9RecordValERKSs_for.cond.i(i32, %"class.llvm::RecordVal"*, i32, i8*, i32*) 147