1*06a8a867SPhilip Reames; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2*06a8a867SPhilip Reames; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s
3*06a8a867SPhilip Reames; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s
4cee313d2SEric Christopher
5cee313d2SEric Christopher@global = external addrspace(1) global i8
6cee313d2SEric Christopher
7cee313d2SEric Christopherdefine i8 @test(i64 %offset) gc "statepoint-example" {
8*06a8a867SPhilip Reames; CHECK-LABEL: @test(
9*06a8a867SPhilip Reames; CHECK-NEXT:    [[DERIVED:%.*]] = getelementptr i8, i8 addrspace(1)* @global, i64 [[OFFSET:%.*]]
10*06a8a867SPhilip Reames; CHECK-NEXT:    [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @extern, i32 0, i32 0, i32 0, i32 0)
11*06a8a867SPhilip Reames; CHECK-NEXT:    [[LOAD:%.*]] = load i8, i8 addrspace(1)* [[DERIVED]], align 1
12*06a8a867SPhilip Reames; CHECK-NEXT:    ret i8 [[LOAD]]
13*06a8a867SPhilip Reames;
14cee313d2SEric Christopher  %derived = getelementptr i8, i8 addrspace(1)* @global, i64 %offset
15cee313d2SEric Christopher  call void @extern()
16cee313d2SEric Christopher  %load = load i8, i8 addrspace(1)* %derived
17cee313d2SEric Christopher  ret i8 %load
18cee313d2SEric Christopher}
19cee313d2SEric Christopher
20cee313d2SEric Christopherdeclare void @extern() gc "statepoint-example"
21cee313d2SEric Christopher
22cee313d2SEric Christopherdeclare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
23