1 ; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=-1 -S < %s | FileCheck %s
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-macosx10.14.0"
6 @c = common global i32 0, align 4
7 @h = common global i32 0, align 4
9 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0
10 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0
11 declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1
15 ; CHECK-LABEL: define void @main()
17 ; CHECK-NEXT: %.sroa.4.i = alloca [20 x i8], align 2
18 ; CHECK-NEXT: %.sroa.5.i = alloca [6 x i8], align 8
20 define void @main() #2 {
22 %.sroa.4.i = alloca [20 x i8], align 2
23 %.sroa.5.i = alloca [6 x i8], align 8
24 %i1 = load i32, ptr @h, align 4, !tbaa !4
25 %i2 = icmp ne i32 %i1, 0
26 br i1 %i2, label %bb11, label %bb3
30 call void @llvm.lifetime.start.p0(i64 20, ptr %.sroa.4.i)
31 call void @llvm.lifetime.start.p0(i64 6, ptr %.sroa.5.i)
32 call void @llvm.memset.p0.i64(ptr align 2 %.sroa.4.i, i8 0, i64 20, i1 false)
33 call void @llvm.memset.p0.i64(ptr align 8 %.sroa.5.i, i8 0, i64 6, i1 false)
34 %i5 = load i32, ptr @c, align 4, !tbaa !4
35 %i6 = trunc i32 %i5 to i16
36 call void @llvm.lifetime.end.p0(i64 20, ptr %.sroa.4.i)
37 call void @llvm.lifetime.end.p0(i64 6, ptr %.sroa.5.i)
38 call void @llvm.lifetime.start.p0(i64 6, ptr %.sroa.5.i)
39 call void @llvm.memset.p0.i64(ptr align 1 %.sroa.5.i, i8 3, i64 6, i1 false)
42 bb7: ; preds = %bb7, %bb3
43 %.0.i = phi i32 [ 0, %bb3 ], [ %i9, %bb7 ]
44 %i8 = sext i32 %.0.i to i64
45 %i9 = add nsw i32 %.0.i, 1
46 %i10 = icmp slt i32 %i9, 6
47 br i1 %i10, label %bb7, label %l.exit
49 l.exit: ; preds = %bb7
50 call void @llvm.lifetime.end.p0(i64 6, ptr %.sroa.5.i)
53 bb11: ; preds = %l.exit, %bb
54 %i12 = phi i1 [ true, %bb ], [ true, %l.exit ]
58 attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
59 attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
60 attributes #2 = { cold }
62 !llvm.module.flags = !{!0, !1, !2}
65 !0 = !{i32 2, !"SDK Version", [2 x i32] [i32 10, i32 14]}
66 !1 = !{i32 1, !"wchar_size", i32 4}
67 !2 = !{i32 8, !"PIC Level", i32 2}
68 !3 = !{!"Apple clang version 11.0.0 (clang-1100.0.20.17)"}
70 !5 = !{!"int", !6, i64 0}
71 !6 = !{!"omnipotent char", !7, i64 0}
72 !7 = !{!"Simple C/C++ TBAA"}