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