1 ; RUN: opt -S %s -verify | FileCheck %s
4 declare i8 addrspace(1)* @llvm.gc.relocate.p1i8(i32, i32, i32)
5 declare i32 @llvm.statepoint.p0f_isVoidf(void ()*, i32, i32, ...)
8 define i8 addrspace(1)* @test1(i8 addrspace(1)* %arg) {
10 %cast = bitcast i8 addrspace(1)* %arg to i64 addrspace(1)*
11 %safepoint_token = call i32 (void ()*, i32, i32, ...)* @llvm.statepoint.p0f_isVoidf(void ()* undef, i32 0, i32 0, i32 5, i32 0, i32 0, i32 0, i32 10, i32 0, i8 addrspace(1)* %arg, i64 addrspace(1)* %cast, i8 addrspace(1)* %arg, i8 addrspace(1)* %arg)
12 %reloc = call i8 addrspace(1)* @llvm.gc.relocate.p1i8(i32 %safepoint_token, i32 9, i32 10)
13 ;; It is perfectly legal to relocate the same value multiple times...
14 %reloc2 = call i8 addrspace(1)* @llvm.gc.relocate.p1i8(i32 %safepoint_token, i32 9, i32 10)
15 %reloc3 = call i8 addrspace(1)* @llvm.gc.relocate.p1i8(i32 %safepoint_token, i32 10, i32 9)
16 ret i8 addrspace(1)* %reloc
22 ; CHECK: ret i8 addrspace(1)* %reloc
25 ; This test catches two cases where the verifier was too strict:
26 ; 1) A base doesn't need to be relocated if it's never used again
27 ; 2) A value can be replaced by one which is known equal. This
28 ; means a potentially derived pointer can be known base and that
29 ; we can't check that derived pointer are never bases.
30 define void @test2(i8 addrspace(1)* %arg, i64 addrspace(1)* %arg2) {
32 %cast = bitcast i8 addrspace(1)* %arg to i64 addrspace(1)*
33 %c = icmp eq i64 addrspace(1)* %cast, %arg2
34 br i1 %c, label %equal, label %notequal
40 %safepoint_token = call i32 (void ()*, i32, i32, ...)* @llvm.statepoint.p0f_isVoidf(void ()* undef, i32 0, i32 0, i32 5, i32 0, i32 0, i32 0, i32 10, i32 0, i8 addrspace(1)* %arg, i64 addrspace(1)* %cast, i8 addrspace(1)* %arg, i8 addrspace(1)* %arg)
41 %reloc = call i8 addrspace(1)* @llvm.gc.relocate.p1i8(i32 %safepoint_token, i32 9, i32 10)
42 call void undef(i8 addrspace(1)* %reloc)
47 ; CHECK-NEXT: %reloc = call