• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -hotcoldsplit -hotcoldsplit-threshold=0 < %s 2>&1 | FileCheck %s
2
3%type1 = type opaque
4%type2 = type opaque
5
6declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
7
8declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
9
10declare void @use(%type1**, %type2**)
11
12declare void @use2(%type1**, %type2**) cold
13
14; CHECK-LABEL: define {{.*}}@foo(
15define void @foo() {
16entry:
17  %local1 = alloca %type1*
18  %local2 = alloca %type2*
19  %local1_cast = bitcast %type1** %local1 to i8*
20  %local2_cast = bitcast %type2** %local2 to i8*
21  br i1 undef, label %normalPath, label %outlinedPath
22
23normalPath:
24  call void @use(%type1** %local1, %type2** %local2)
25  ret void
26
27; CHECK-LABEL: codeRepl:
28; CHECK: [[local1_cast:%.*]] = bitcast %type1** %local1 to i8*
29; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 -1, i8* [[local1_cast]])
30; CHECK-NEXT: [[local2_cast:%.*]] = bitcast %type2** %local2 to i8*
31; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 -1, i8* [[local2_cast]])
32; CHECK-NEXT: call void @foo.cold.1(i8* %local1_cast, i8* %local2_cast
33
34outlinedPath:
35  call void @llvm.lifetime.start.p0i8(i64 1, i8* %local1_cast)
36  call void @llvm.lifetime.start.p0i8(i64 1, i8* %local2_cast)
37  call void @use2(%type1** %local1, %type2** %local2)
38  call void @llvm.lifetime.end.p0i8(i64 1, i8* %local1_cast)
39  call void @llvm.lifetime.end.p0i8(i64 1, i8* %local2_cast)
40  br label %outlinedPathExit
41
42outlinedPathExit:
43  ret void
44}
45
46; CHECK-LABEL: define {{.*}}@foo.cold.1(
47; CHECK-NOT: @llvm.lifetime
48