Skip to content

Commit 506eb6c

Browse files
author
Serguei Katkov
committed
[Safepoint Verifier] Add a false positive test.
1 parent f208644 commit 506eb6c

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
; RUN: opt -safepoint-ir-verifier-print-only -verify-safepoint-ir -S %s 2>&1 | FileCheck %s
2+
3+
; This is a false positive case. Actually base of %tmp5 is null but verifier does not see that.
4+
; As a result it states that %tmp5 can have a unrelocated value of %tmp.
5+
; Relocation of %tmp is expected to be after the call to @widget but it is not required
6+
; due to %tmp is always null as well.
7+
8+
; CHECK-LABEL: Verifying gc pointers in function: test
9+
; CHECK: Illegal use of unrelocated value found!
10+
define i8 addrspace(1)* @test(i1 %arg) gc "statepoint-example" {
11+
bb:
12+
br label %bb2
13+
14+
bb2: ; preds = %bb8, %bb
15+
%tmp = phi i8 addrspace(1)* [ %tmp5.relocated, %bb8 ], [ null, %bb ]
16+
%statepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* elementtype(void ()) @widget, i32 0, i32 0, i32 0, i32 0) [ "deopt"() ]
17+
br label %bb4
18+
19+
bb4: ; preds = %bb8, %bb2
20+
%tmp5 = phi i8 addrspace(1)* [ %tmp5.relocated, %bb8 ], [ %tmp, %bb2 ]
21+
%statepoint_token1 = call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 2882400000, i32 0, i1 ()* elementtype(i1 ()) @baz, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i8 addrspace(1)* %tmp5), "gc-live"(i8 addrspace(1)* %tmp5) ]
22+
%tmp62 = call i1 @llvm.experimental.gc.result.i1(token %statepoint_token1)
23+
%tmp5.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %statepoint_token1, i32 0, i32 0) ; (%tmp5, %tmp5)
24+
br i1 %tmp62, label %bb8, label %bb6
25+
26+
bb6: ; preds = %bb4
27+
ret i8 addrspace(1)* null
28+
29+
bb8: ; preds = %bb4
30+
br i1 %arg, label %bb4, label %bb2
31+
}
32+
33+
declare void @widget()
34+
declare i1 @baz()
35+
36+
declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 immarg, i32 immarg, void ()*, i32 immarg, i32 immarg, ...)
37+
declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64 immarg, i32 immarg, i1 ()*, i32 immarg, i32 immarg, ...)
38+
declare i1 @llvm.experimental.gc.result.i1(token)
39+
declare i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token, i32 immarg, i32 immarg)

0 commit comments

Comments
 (0)