xref: /llvm-project/llvm/test/Transforms/CodeExtractor/PartialInlineAlloca4.ll (revision 60cdd12d7a0eba6e1d3b8a0eaa24f21f86876fd3)
1; RUN: opt < %s -passes=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 { ptr }
5%"struct.base" = type opaque
6
7@g = external local_unnamed_addr global i32, align 4
8
9; CHECK-LABEL: define{{.*}}@caller(
10; CHECK: call void @llvm.lifetime.start.p0(i64 -1, ptr %tmp.i)
11; CHECK-NEXT: call void @callee_unknown_use1.{{.*}}(ptr %tmp.i
12
13define i32 @callee_unknown_use1(i32 %arg) local_unnamed_addr #0 {
14; CHECK-LABEL:define{{.*}}@callee_unknown_use1.{{[0-9]}}
15; CHECK-NOT: alloca
16bb:
17  %tmp = alloca  i8, align 4
18  %tmp2 = load i32, ptr @g, align 4, !tbaa !2
19  %tmp3 = add nsw i32 %tmp2, 1
20  %tmp4 = icmp slt i32 %arg, 0
21  br i1 %tmp4, label %bb6, label %bb5
22
23bb5:                                              ; preds = %bb
24  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp) #2
25  store i32 %tmp3, ptr @g, align 4, !tbaa !2
26  %tmp11 = bitcast ptr %tmp to ptr
27  call void @bar(ptr nonnull %tmp11) #2
28  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tmp) #2
29  br label %bb6
30
31bb6:                                              ; preds = %bb5, %bb
32  %tmp7 = phi i32 [ 1, %bb5 ], [ 0, %bb ]
33  %tmp1 = bitcast ptr %tmp to ptr
34  ret i32 %tmp7
35}
36
37
38; Function Attrs: argmemonly nounwind
39declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1
40
41declare void @bar(ptr) local_unnamed_addr #2
42declare void @bar2(ptr, ptr) local_unnamed_addr #1
43
44
45; Function Attrs: argmemonly nounwind
46declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1
47
48; Function Attrs: nounwind uwtable
49define i32 @caller(i32 %arg) local_unnamed_addr #0 {
50bb:
51  %tmp = tail call i32 @callee_unknown_use1(i32 %arg)
52  ret i32 %tmp
53}
54
55attributes #0 = { nounwind uwtable}
56attributes #1 = { argmemonly nounwind }
57attributes #2 = { nounwind }
58
59!llvm.module.flags = !{!0}
60!llvm.ident = !{!1}
61
62!0 = !{i32 1, !"wchar_size", i32 4}
63!1 = !{!"clang version 5.0.0 (trunk 303574)"}
64!2 = !{!3, !3, i64 0}
65!3 = !{!"int", !4, i64 0}
66!4 = !{!"omnipotent char", !5, i64 0}
67!5 = !{!"Simple C/C++ TBAA"}
68
69
70
71