1 ; RUN: opt -S -passes=hotcoldsplit -hotcoldsplit-threshold=0 < %s 2>&1 | FileCheck %s
3 declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
5 declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
9 declare void @cold_use2(ptr, ptr) cold
11 ; CHECK-LABEL: define {{.*}}@foo(
16 br i1 undef, label %normalPath, label %outlinedPath
19 ; These two uses of stack slots are non-overlapping. Based on this alone,
20 ; the stack slots could be merged.
21 call void @llvm.lifetime.start.p0(i64 1, ptr %local1)
22 call void @use(ptr %local1)
23 call void @llvm.lifetime.end.p0(i64 1, ptr %local1)
24 call void @llvm.lifetime.start.p0(i64 1, ptr %local2)
25 call void @use(ptr %local2)
26 call void @llvm.lifetime.end.p0(i64 1, ptr %local2)
29 ; CHECK-LABEL: codeRepl:
30 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr %local1)
31 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr %local2)
32 ; CHECK-NEXT: call i1 @foo.cold.1(ptr %local1, ptr %local2)
36 ; These two uses of stack slots are overlapping. This should prevent
37 ; merging of stack slots. CodeExtractor must replicate the effects of
38 ; these markers in the caller to inhibit stack coloring.
39 %gep1 = getelementptr inbounds i8, ptr %local1, i64 1
40 call void @llvm.lifetime.start.p0(i64 1, ptr %gep1)
41 call void @llvm.lifetime.start.p0(i64 1, ptr %local2)
42 call void @cold_use2(ptr %local1, ptr %local2)
43 call void @llvm.lifetime.end.p0(i64 1, ptr %gep1)
44 call void @llvm.lifetime.end.p0(i64 1, ptr %local2)
45 br i1 undef, label %outlinedPath2, label %outlinedPathExit
48 ; These extra lifetime markers are used to test that we emit only one
49 ; pair of guard markers in the caller per memory object.
50 call void @llvm.lifetime.start.p0(i64 1, ptr %local2)
51 call void @use(ptr %local2)
52 call void @llvm.lifetime.end.p0(i64 1, ptr %local2)
59 ; CHECK-LABEL: define {{.*}}@foo.cold.1(
60 ; CHECK-NOT: @llvm.lifetime