1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s
3 ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s
6 @global = external addrspace(1) global i8
8 ; derived %select base null
9 define i8 @test(i1 %cond) gc "statepoint-example" {
11 ; CHECK-NEXT: [[DERIVED1:%.*]] = getelementptr i8, i8 addrspace(1)* @global, i64 1
12 ; CHECK-NEXT: [[DERIVED2:%.*]] = getelementptr i8, i8 addrspace(1)* @global, i64 2
13 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND:%.*]], i8 addrspace(1)* [[DERIVED1]], i8 addrspace(1)* [[DERIVED2]]
14 ; 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)
15 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, i8 addrspace(1)* [[SELECT]], align 1
16 ; CHECK-NEXT: ret i8 [[LOAD]]
18 %derived1 = getelementptr i8, i8 addrspace(1)* @global, i64 1
19 %derived2 = getelementptr i8, i8 addrspace(1)* @global, i64 2
20 %select = select i1 %cond, i8 addrspace(1)* %derived1, i8 addrspace(1)* %derived2
22 %load = load i8, i8 addrspace(1)* %select
26 declare void @extern() gc "statepoint-example"
28 declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)