llvm.org GIT mirror llvm / 69a5c89
PlaceSafepoints: modernize gc.result.* -> gc.result Differential Revision: http://reviews.llvm.org/D7516 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228625 91177308-0d34-0410-b5e6-96231b3b80d8 Ramkumar Ramachandra 4 years ago
2 changed file(s) with 17 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
951951 Instruction *gc_result = nullptr;
952952 std::vector types; // one per 'any' type
953953 types.push_back(CS.getType()); // result type
954 auto get_gc_result_id = [&](Type &Ty) {
955 if (Ty.isIntegerTy()) {
956 return Intrinsic::experimental_gc_result_int;
957 } else if (Ty.isFloatingPointTy()) {
958 return Intrinsic::experimental_gc_result_float;
959 } else if (Ty.isPointerTy()) {
960 return Intrinsic::experimental_gc_result_ptr;
961 } else {
962 llvm_unreachable("non java type encountered");
963 }
964 };
965 Intrinsic::ID Id = get_gc_result_id(*CS.getType());
954 Intrinsic::ID Id = Intrinsic::experimental_gc_result;
966955 Value *gc_result_func = Intrinsic::getDeclaration(M, Id, types);
967956
968957 std::vector args;
5050 br label %other
5151 other:
5252 ; CHECK-LABEL: other
53 ; CHECK: statepoint
53 ; CHECK: statepoint
54 ; CHECK-NOT: gc.result
5455 call void @foo()
5556 ret void
5657 }
5758
59 declare zeroext i1 @i1_return_i1(i1)
60
61 define i1 @test_call_with_result() gc "statepoint-example" {
62 ; CHECK-LABEL: test_call_with_result
63 ; This is checking that a statepoint_poll + statepoint + result is
64 ; inserted for a function that takes 1 argument.
65 ; CHECK: gc.statepoint.p0f_isVoidf
66 ; CHECK: gc.statepoint.p0f_i1i1f
67 ; CHECK: (i1 (i1)* @i1_return_i1, i32 1, i32 0, i1 false, i32 0)
68 ; CHECK: gc.result.i1
69 entry:
70 %call1 = tail call i1 (i1)* @i1_return_i1(i1 false)
71 ret i1 %call1
72 }
5873
5974 ; This function is inlined when inserting a poll. To avoid recursive
6075 ; issues, make sure we don't place safepoints in it.