2 ; RUN: opt < %s -partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s
3 ; RUN: opt < %s -passes=partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s
5 %"class.base" = type { %"struct.base"* }
6 %"struct.base" = type opaque
8 @g = external local_unnamed_addr global i32, align 4
10 ; Function Attrs: nounwind uwtable
11 define i32 @callee_sinkable_bitcast(i32 %arg) local_unnamed_addr #0 {
12 ; CHECK-LABEL:define{{.*}}@callee_sinkable_bitcast.{{[0-9]}}
15 ; CHECK: call void @llvm.lifetime
17 %tmp = alloca %"class.base", align 4
18 %tmp1 = bitcast %"class.base"* %tmp to i8*
19 %tmp2 = load i32, i32* @g, align 4, !tbaa !2
20 %tmp3 = add nsw i32 %tmp2, 1
21 %tmp4 = icmp slt i32 %arg, 0
22 br i1 %tmp4, label %bb6, label %bb5
25 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %tmp1) #2
26 %tmp11 = bitcast %"class.base"* %tmp to i32*
27 store i32 %tmp3, i32* %tmp11, align 4, !tbaa !2
28 store i32 %tmp3, i32* @g, align 4, !tbaa !2
29 call void @bar(i32* nonnull %tmp11) #2
30 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %tmp1) #2
33 bb6: ; preds = %bb5, %bb
34 %tmp7 = phi i32 [ 1, %bb5 ], [ 0, %bb ]
38 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
40 declare void @bar(i32*) local_unnamed_addr #2
41 declare void @bar2(i32*, i32*) local_unnamed_addr #1
44 ; Function Attrs: argmemonly nounwind
45 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
47 ; Function Attrs: nounwind uwtable
48 define i32 @caller(i32 %arg) local_unnamed_addr #0 {
50 %tmp = tail call i32 @callee_sinkable_bitcast(i32 %arg)
54 attributes #0 = { nounwind uwtable}
55 attributes #1 = { argmemonly nounwind }
56 attributes #2 = { nounwind }
58 !llvm.module.flags = !{!0}
61 !0 = !{i32 1, !"wchar_size", i32 4}
62 !1 = !{!"clang version 5.0.0 (trunk 303574)"}
64 !3 = !{!"int", !4, i64 0}
65 !4 = !{!"omnipotent char", !5, i64 0}
66 !5 = !{!"Simple C/C++ TBAA"}