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 6cee313d2SEric Christopher@global = external addrspace(1) global i8 7cee313d2SEric Christopher 8*06a8a867SPhilip Reames; derived %select base null 9cee313d2SEric Christopherdefine i8 @test(i1 %cond) gc "statepoint-example" { 10*06a8a867SPhilip Reames; CHECK-LABEL: @test( 11*06a8a867SPhilip Reames; CHECK-NEXT: [[DERIVED1:%.*]] = getelementptr i8, i8 addrspace(1)* @global, i64 1 12*06a8a867SPhilip Reames; CHECK-NEXT: [[DERIVED2:%.*]] = getelementptr i8, i8 addrspace(1)* @global, i64 2 13*06a8a867SPhilip Reames; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND:%.*]], i8 addrspace(1)* [[DERIVED1]], i8 addrspace(1)* [[DERIVED2]] 14*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) 15*06a8a867SPhilip Reames; CHECK-NEXT: [[LOAD:%.*]] = load i8, i8 addrspace(1)* [[SELECT]], align 1 16*06a8a867SPhilip Reames; CHECK-NEXT: ret i8 [[LOAD]] 17*06a8a867SPhilip Reames; 18cee313d2SEric Christopher %derived1 = getelementptr i8, i8 addrspace(1)* @global, i64 1 19cee313d2SEric Christopher %derived2 = getelementptr i8, i8 addrspace(1)* @global, i64 2 20cee313d2SEric Christopher %select = select i1 %cond, i8 addrspace(1)* %derived1, i8 addrspace(1)* %derived2 21cee313d2SEric Christopher call void @extern() 22cee313d2SEric Christopher %load = load i8, i8 addrspace(1)* %select 23cee313d2SEric Christopher ret i8 %load 24cee313d2SEric Christopher} 25cee313d2SEric Christopher 26cee313d2SEric Christopherdeclare void @extern() gc "statepoint-example" 27cee313d2SEric Christopher 28cee313d2SEric Christopherdeclare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...) 29