llvm.org GIT mirror llvm / 2b98443
[RS4GC] Handle call/invoke instructions as base defining values of vectors Summary: There's an asymmetry in the definitions of findBaseDefiningValueOfVector() and findBaseDefiningValue() of RS4GC. The later handles call and invoke instructions, and the former does not. This appears to be simple oversight. This patch remedies the oversight by adding the call and invoke cases to findBaseDefiningValueOfVector(). Reviewers: DaniilSuchkov, anna Reviewed By: anna Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42653 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323764 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Neilson 1 year, 7 months ago
3 changed file(s) with 48 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
475475 if (auto *BC = dyn_cast(I))
476476 return findBaseDefiningValue(BC->getOperand(0));
477477
478 // We assume that functions in the source language only return base
479 // pointers. This should probably be generalized via attributes to support
480 // both source language and internal functions.
481 if (isa(I) || isa(I))
482 return BaseDefiningValueResult(I, true);
483
478484 // A PHI or Select is a base defining value. The outer findBasePointer
479485 // algorithm is responsible for constructing a base value for this BDV.
480486 assert((isa(I) || isa(I)) &&
260260 call void @use_vec(<4 x i64 addrspace(1) *> %vec2)
261261 ret void
262262 }
263
264 declare <4 x i64 addrspace(1)*> @def_vec() "gc-leaf-function"
265
266 define void @test12(<4 x i64 addrspace(1)*> %vec1) gc "statepoint-example" {
267 ; CHECK-LABEL: @test12(
268 ; CHECK: @llvm.experimental.gc.statepoint.p0f_isVoidf{{.*}}<4 x i64 addrspace(1)*> %vec)
269 ; CHECK-NEXT: %vec.relocated = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8(
270 ; CHECK-NEXT: %vec.relocated.casted = bitcast <4 x i8 addrspace(1)*> %vec.relocated to <4 x i64 addrspace(1)*>
271 ; CHECK-NEXT: call void @use_vec(<4 x i64 addrspace(1)*> %vec.relocated.casted)
272 ; CHECK-NEXT: ret void
273 entry:
274 %vec = call <4 x i64 addrspace(1)*> @def_vec()
275 call void @do_safepoint() [ "deopt"() ]
276 call void @use_vec(<4 x i64 addrspace(1)*> %vec)
277 ret void
278 }
2727 %landing_pad4 = landingpad token
2828 cleanup
2929 ret i64 addrspace(1)* %obj1
30 }
31
32 declare <4 x i64 addrspace(1)*> @some_vector_call(<4 x i64 addrspace(1)*>)
33
34 define <4 x i64 addrspace(1)*> @test_basic_vector(<4 x i64 addrspace(1)*> %objs, <4 x i64 addrspace(1)*> %objs1) gc "statepoint-example" personality i32 ()* @personality_function {
35 ; CHECK-LABEL: @test_basic_vector
36 entry:
37 ; CHECK: invoke{{.*}}llvm.experimental.gc.statepoint{{.*}}some_vector_call
38 %ret_val = invoke <4 x i64 addrspace(1)*> @some_vector_call(<4 x i64 addrspace(1)*> %objs)
39 to label %normal_return unwind label %exceptional_return
40
41 ; CHECK-LABEL: normal_return:
42 ; CHECK: gc.result
43 ; CHECK: ret <4 x i64 addrspace(1)*>
44
45 normal_return:
46 ret <4 x i64 addrspace(1)*> %ret_val
47
48 ; CHECK-LABEL: exceptional_return:
49 ; CHECK: landingpad
50 ; CHECK: ret <4 x i64 addrspace(1)*>
51
52 exceptional_return:
53 %landing_pad4 = landingpad token
54 cleanup
55 ret <4 x i64 addrspace(1)*> %objs1
3056 }
3157
3258 define i64 addrspace(1)* @test_two_invokes(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality_function {