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 4 5; derived %next.i64 base %base_obj 6 7define void @test(i64 addrspace(1)* %base_obj) gc "statepoint-example" { 8; CHECK-LABEL: @test( 9; CHECK-NEXT: entry: 10; CHECK-NEXT: [[OBJ:%.*]] = getelementptr i64, i64 addrspace(1)* [[BASE_OBJ:%.*]], i32 1 11; CHECK-NEXT: br label [[LOOP:%.*]] 12; CHECK: loop: 13; CHECK-NEXT: [[DOT0:%.*]] = phi i64 addrspace(1)* [ [[BASE_OBJ]], [[ENTRY:%.*]] ], [ [[BASE_OBJ_RELOCATED_CASTED:%.*]], [[LOOP]] ] 14; CHECK-NEXT: [[CURRENT:%.*]] = phi i64 addrspace(1)* [ [[OBJ]], [[ENTRY]] ], [ [[NEXT_I64_RELOCATED_CASTED:%.*]], [[LOOP]] ] 15; CHECK-NEXT: [[CURRENT_I32:%.*]] = bitcast i64 addrspace(1)* [[CURRENT]] to i32 addrspace(1)* 16; CHECK-NEXT: [[NEXT_I32:%.*]] = getelementptr i32, i32 addrspace(1)* [[CURRENT_I32]], i32 1 17; CHECK-NEXT: [[NEXT_I64:%.*]] = bitcast i32 addrspace(1)* [[NEXT_I32]] to i64 addrspace(1)* 18; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* elementtype(void ()) @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[NEXT_I64]], i64 addrspace(1)* [[DOT0]]) ] 19; CHECK-NEXT: [[NEXT_I64_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0) 20; CHECK-NEXT: [[NEXT_I64_RELOCATED_CASTED]] = bitcast i8 addrspace(1)* [[NEXT_I64_RELOCATED]] to i64 addrspace(1)* 21; CHECK-NEXT: [[BASE_OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1) 22; CHECK-NEXT: [[BASE_OBJ_RELOCATED_CASTED]] = bitcast i8 addrspace(1)* [[BASE_OBJ_RELOCATED]] to i64 addrspace(1)* 23; CHECK-NEXT: br label [[LOOP]] 24; 25entry: 26 %obj = getelementptr i64, i64 addrspace(1)* %base_obj, i32 1 27 br label %loop 28 29loop: ; preds = %loop, %entry 30 %current = phi i64 addrspace(1)* [ %obj, %entry ], [ %next.i64, %loop ] 31 %current.i32 = bitcast i64 addrspace(1)* %current to i32 addrspace(1)* 32 %next.i32 = getelementptr i32, i32 addrspace(1)* %current.i32, i32 1 33 %next.i64 = bitcast i32 addrspace(1)* %next.i32 to i64 addrspace(1)* 34 call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ] 35 br label %loop 36} 37 38declare void @do_safepoint() 39