1 ; The expected behavior of this file is expected to change when partial
2 ; inlining legality check is enhanced.
4 ; RUN: opt -S -partial-inliner -skip-partial-inlining-cost-analysis < %s | FileCheck %s
5 ; RUN: opt -S -passes=partial-inliner -skip-partial-inlining-cost-analysis < %s | FileCheck %s
7 %class.A = type { i32 }
9 @cond = local_unnamed_addr global i32 0, align 4
10 @condptr = external local_unnamed_addr global i32*, align 8
12 ; Function Attrs: uwtable
13 define void @_Z3foo_unknown_mem_accessv() local_unnamed_addr {
15 %tmp = alloca %class.A, align 4
16 %tmp1 = alloca %class.A, align 4
17 %tmp2 = bitcast %class.A* %tmp to i8*
18 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %tmp2)
19 %tmp3 = bitcast %class.A* %tmp1 to i8*
20 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %tmp3)
21 %tmp4 = load i32*, i32** @condptr, align 8, !tbaa !2
22 %tmp5 = load i32, i32* %tmp4, align 4, !tbaa !6
23 %tmp6 = icmp eq i32 %tmp5, 0
24 br i1 %tmp6, label %bb7, label %bb8
27 call void @_ZN1A7memfuncEv(%class.A* nonnull %tmp)
30 bb8: ; preds = %bb7, %bb
31 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %tmp3)
32 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %tmp2)
36 declare void @_Z3barv() local_unnamed_addr
37 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
38 declare void @_ZN1A7memfuncEv(%class.A*) local_unnamed_addr
39 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
41 define void @_Z3foo_unknown_calli(i32 %arg) local_unnamed_addr {
43 %tmp = alloca %class.A, align 4
44 %tmp1 = bitcast %class.A* %tmp to i8*
45 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %tmp1)
46 tail call void @_Z3barv()
47 %tmp2 = icmp eq i32 %arg, 0
48 br i1 %tmp2, label %bb3, label %bb4
51 call void @_ZN1A7memfuncEv(%class.A* nonnull %tmp)
54 bb4: ; preds = %bb3, %bb
55 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %tmp1)
59 define void @_Z3goov() local_unnamed_addr {
60 ; CHECK-LABEL: @_Z3goov
65 call void @_Z3foo_unknown_mem_accessv()
66 %tmp = load i32, i32* @cond, align 4, !tbaa !2
67 tail call void @_Z3foo_unknown_calli(i32 %tmp)
71 ; CHECK-LABEL define internal void @_Z3foo_unknown_calli.1_bb3
73 ; CHECK-NEXT: br label %bb3
75 ; CHECK: bb4.exitStub:
76 ; CHECK-NEXT: ret void
79 ; CHECK-NOT: lifetime.ed
80 ; CHECK: br label %bb4.exitStub
84 !llvm.module.flags = !{!0}
87 !0 = !{i32 1, !"wchar_size", i32 4}
88 !1 = !{!"clang version 5.0.0 (trunk 304489)"}
90 !3 = !{!"any pointer", !4, i64 0}
91 !4 = !{!"omnipotent char", !5, i64 0}
92 !5 = !{!"Simple C++ TBAA"}
94 !7 = !{!"int", !4, i64 0}