106a8a867SPhilip Reames; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 206a8a867SPhilip Reames; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s 306a8a867SPhilip Reames; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s 4cee313d2SEric Christopher 506a8a867SPhilip Reames; derived %merged_value base %base_obj 6cee313d2SEric Christopherdefine i64 addrspace(1)* @test(i64 addrspace(1)* %base_obj, i1 %runtime_condition) gc "statepoint-example" { 706a8a867SPhilip Reames; CHECK-LABEL: @test( 806a8a867SPhilip Reames; CHECK-NEXT: entry: 906a8a867SPhilip Reames; CHECK-NEXT: br i1 [[RUNTIME_CONDITION:%.*]], label [[MERGE:%.*]], label [[THERE:%.*]] 1006a8a867SPhilip Reames; CHECK: there: 1106a8a867SPhilip Reames; CHECK-NEXT: [[DERIVED_OBJ:%.*]] = getelementptr i64, i64 addrspace(1)* [[BASE_OBJ:%.*]], i32 1 1206a8a867SPhilip Reames; CHECK-NEXT: br label [[MERGE]] 1306a8a867SPhilip Reames; CHECK: merge: 1406a8a867SPhilip Reames; CHECK-NEXT: [[MERGED_VALUE:%.*]] = phi i64 addrspace(1)* [ [[BASE_OBJ]], [[ENTRY:%.*]] ], [ [[DERIVED_OBJ]], [[THERE]] ] 15*c680eeabSNikita Popov; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* elementtype(void ()) @foo, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[MERGED_VALUE]], i64 addrspace(1)* [[BASE_OBJ]]) ] 1606a8a867SPhilip Reames; CHECK-NEXT: [[MERGED_VALUE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0) 1706a8a867SPhilip Reames; CHECK-NEXT: [[MERGED_VALUE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[MERGED_VALUE_RELOCATED]] to i64 addrspace(1)* 1806a8a867SPhilip Reames; CHECK-NEXT: [[BASE_OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1) 1906a8a867SPhilip Reames; CHECK-NEXT: [[BASE_OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BASE_OBJ_RELOCATED]] to i64 addrspace(1)* 2006a8a867SPhilip Reames; CHECK-NEXT: ret i64 addrspace(1)* [[MERGED_VALUE_RELOCATED_CASTED]] 2106a8a867SPhilip Reames; 22cee313d2SEric Christopherentry: 23cee313d2SEric Christopher br i1 %runtime_condition, label %merge, label %there 24cee313d2SEric Christopher 25cee313d2SEric Christopherthere: ; preds = %entry 26cee313d2SEric Christopher %derived_obj = getelementptr i64, i64 addrspace(1)* %base_obj, i32 1 27cee313d2SEric Christopher br label %merge 28cee313d2SEric Christopher 29cee313d2SEric Christophermerge: ; preds = %there, %entry 30cee313d2SEric Christopher %merged_value = phi i64 addrspace(1)* [ %base_obj, %entry ], [ %derived_obj, %there ] 31cee313d2SEric Christopher call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ] 32cee313d2SEric Christopher ret i64 addrspace(1)* %merged_value 33cee313d2SEric Christopher} 34cee313d2SEric Christopher 35cee313d2SEric Christopherdeclare void @foo() 36