1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s
5 @global = external addrspace(1) global i8
7 ; derived %select base null
8 define i8 @test(i1 %cond) gc "statepoint-example" {
10 ; CHECK-NEXT: [[DERIVED1:%.*]] = getelementptr i8, ptr addrspace(1) @global, i64 1
11 ; CHECK-NEXT: [[DERIVED2:%.*]] = getelementptr i8, ptr addrspace(1) @global, i64 2
12 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND:%.*]], ptr addrspace(1) [[DERIVED1]], ptr addrspace(1) [[DERIVED2]]
13 ; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @extern, i32 0, i32 0, i32 0, i32 0)
14 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(1) [[SELECT]], align 1
15 ; CHECK-NEXT: ret i8 [[LOAD]]
17 %derived1 = getelementptr i8, ptr addrspace(1) @global, i64 1
18 %derived2 = getelementptr i8, ptr addrspace(1) @global, i64 2
19 %select = select i1 %cond, ptr addrspace(1) %derived1, ptr addrspace(1) %derived2
21 %load = load i8, ptr addrspace(1) %select
25 declare void @extern() gc "statepoint-example"
27 declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)