Index: test/CodeGen/X86/statepoint-call-lowering.ll =================================================================== --- test/CodeGen/X86/statepoint-call-lowering.ll +++ test/CodeGen/X86/statepoint-call-lowering.ll @@ -75,6 +75,41 @@ ret i1 %call2 } +define i32 @test_relocate_integer(i32 addrspace(1)* %i) gc "statepoint-example" { +; CHECK-LABEL: test_relocate_integer +; Check that relocation of an integer is lowered correctly +; CHECK: pushq %rax +; CHECK: callq return_i1 +; CHECK-NEXT: .Ltmp16: +; CHECK-NEXT: movq (%rsp), %rax +; CHECK-NEXT: movl (%rax), %eax +; CHECK-NEXT: popq %rdx +; CHECK-NEXT: retq +entry: + %tok = tail call i32 (i1 ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 addrspace(1)* %i) + %i-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok, i32 4, i32 4) + %ret = load i32 addrspace(1)* %i-new + ret i32 %ret +} + +define [3 x i32] @test_relocate_array([3 x i32] addrspace(1)* %v) gc "statepoint-example" { +; CHECK-LABEL: test_relocate_array +; Check that relocation of an array of integers is lowered correctly +; CHECK: pushq %rax +; CHECK: callq return_i1 +; CHECK-NEXT: .Ltmp19: +; CHECK-NEXT: movq (%rsp), %rcx +; CHECK-NEXT: movl (%rcx), %eax +; CHECK-NEXT: movl 4(%rcx), %edx +; CHECK-NEXT: movl 8(%rcx), %ecx +; CHECK-NEXT: popq %rsi +; CHECK-NEXT: retq + %tok = call i32 (i1 ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()* @return_i1, i32 0, i32 0, i32 0, [3 x i32] addrspace(1)* %v) + %v-new = call [3 x i32] addrspace(1)* @llvm.experimental.gc.relocate.p1a3i32(i32 %tok, i32 4, i32 4) + %ret = load [3 x i32] addrspace(1)* %v-new + ret [3 x i32] %ret +} + declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()*, i32, i32, ...) declare i1 @llvm.experimental.gc.result.int.i1(i32) @@ -88,3 +123,4 @@ declare float @llvm.experimental.gc.result.float.f32(i32) declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) +declare [3 x i32] addrspace(1)* @llvm.experimental.gc.relocate.p1a3i32(i32, i32, i32)