[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
llvm-svn: 323764
diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/invokes.ll b/llvm/test/Transforms/RewriteStatepointsForGC/invokes.ll
index d9ebd30..b87420e 100644
--- a/llvm/test/Transforms/RewriteStatepointsForGC/invokes.ll
+++ b/llvm/test/Transforms/RewriteStatepointsForGC/invokes.ll
@@ -30,6 +30,32 @@
ret i64 addrspace(1)* %obj1
}
+declare <4 x i64 addrspace(1)*> @some_vector_call(<4 x i64 addrspace(1)*>)
+
+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 {
+; CHECK-LABEL: @test_basic_vector
+entry:
+; CHECK: invoke{{.*}}llvm.experimental.gc.statepoint{{.*}}some_vector_call
+ %ret_val = invoke <4 x i64 addrspace(1)*> @some_vector_call(<4 x i64 addrspace(1)*> %objs)
+ to label %normal_return unwind label %exceptional_return
+
+; CHECK-LABEL: normal_return:
+; CHECK: gc.result
+; CHECK: ret <4 x i64 addrspace(1)*>
+
+normal_return:
+ ret <4 x i64 addrspace(1)*> %ret_val
+
+; CHECK-LABEL: exceptional_return:
+; CHECK: landingpad
+; CHECK: ret <4 x i64 addrspace(1)*>
+
+exceptional_return:
+ %landing_pad4 = landingpad token
+ cleanup
+ ret <4 x i64 addrspace(1)*> %objs1
+}
+
define i64 addrspace(1)* @test_two_invokes(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality_function {
; CHECK-LABEL: entry:
entry: