Skip to content

Commit d5be1aa

Browse files
committed
[test] HotColdSplit: cover use of opaque pointer type
Add a test to cover the case where an extracted block contains a lifetime marker for a pointer with an opaque type. (cherry picked from commit da27beb)
1 parent e548751 commit d5be1aa

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
; RUN: opt -S -hotcoldsplit -hotcoldsplit-threshold=0 < %s 2>&1 | FileCheck %s
2+
3+
%type1 = type opaque
4+
%type2 = type opaque
5+
6+
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
7+
8+
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
9+
10+
declare void @use(%type1**, %type2**)
11+
12+
declare void @use2(%type1**, %type2**) cold
13+
14+
; CHECK-LABEL: define {{.*}}@foo(
15+
define void @foo() {
16+
entry:
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+
23+
normalPath:
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+
34+
outlinedPath:
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+
42+
outlinedPathExit:
43+
ret void
44+
}
45+
46+
; CHECK-LABEL: define {{.*}}@foo.cold.1(
47+
; CHECK-NOT: @llvm.lifetime

0 commit comments

Comments
 (0)