1; RUN: llc -mtriple=i386-apple-macosx -relocation-model=pic < %s > /dev/null
2; RUN: llc -mtriple=x86_64-apple-macosx -relocation-model=pic < %s > /dev/null
3
4; rdar://12393897
5
6%TRp = type { i32, %TRH*, i32, i32 }
7%TRH = type { i8*, i8*, i8*, i8*, {}* }
8
9define i32 @t(%TRp* inreg %rp) nounwind optsize ssp {
10entry:
11  %handler = getelementptr inbounds %TRp, %TRp* %rp, i32 0, i32 1
12  %0 = load %TRH*, %TRH** %handler, align 4
13  %sync = getelementptr inbounds %TRH, %TRH* %0, i32 0, i32 4
14  %sync12 = load {}*, {}** %sync, align 4
15  %1 = bitcast {}* %sync12 to i32 (%TRp*)*
16  %call = tail call i32 %1(%TRp* inreg %rp) nounwind optsize
17  ret i32 %call
18}
19
20%btConeShape = type { %btConvexInternalShape, float, float, float, [3 x i32] }
21%btConvexInternalShape = type { %btConvexShape, %btVector, %btVector, float, float }
22%btConvexShape = type { %btCollisionShape }
23%btCollisionShape = type { i32 (...)**, i32, i8* }
24%btVector = type { [4 x float] }
25
26define { <2 x float>, <2 x float> } @t2(%btConeShape* %this) unnamed_addr uwtable ssp align 2 {
27entry:
28  %0 = getelementptr inbounds %btConeShape, %btConeShape* %this, i64 0, i32 0
29  br i1 undef, label %if.then, label %if.end17
30
31if.then:                                          ; preds = %entry
32  %vecnorm.sroa.2.8.copyload = load float, float* undef, align 4
33  %cmp4 = fcmp olt float undef, 0x3D10000000000000
34  %vecnorm.sroa.2.8.copyload36 = select i1 %cmp4, float -1.000000e+00, float %vecnorm.sroa.2.8.copyload
35  %call.i.i.i = tail call float @sqrtf(float 0.000000e+00) nounwind readnone
36  %div.i.i = fdiv float 1.000000e+00, %call.i.i.i
37  %mul7.i.i.i = fmul float %div.i.i, %vecnorm.sroa.2.8.copyload36
38  %1 = load float (%btConvexInternalShape*)*, float (%btConvexInternalShape*)** undef, align 8
39  %call12 = tail call float %1(%btConvexInternalShape* %0)
40  %mul7.i.i = fmul float %call12, %mul7.i.i.i
41  %retval.sroa.0.4.insert = insertelement <2 x float> zeroinitializer, float undef, i32 1
42  %add13.i = fadd float undef, %mul7.i.i
43  %retval.sroa.1.8.insert = insertelement <2 x float> undef, float %add13.i, i32 0
44  br label %if.end17
45
46if.end17:                                         ; preds = %if.then, %entry
47  %retval.sroa.1.8.load3338 = phi <2 x float> [ %retval.sroa.1.8.insert, %if.then ], [ undef, %entry ]
48  %retval.sroa.0.0.load3137 = phi <2 x float> [ %retval.sroa.0.4.insert, %if.then ], [ undef, %entry ]
49  ret { <2 x float>, <2 x float> } undef
50}
51
52declare float @sqrtf(float) nounwind readnone
53