[PATCH] D42653: [RS4GC] Handle call/invoke instructions as base defining values of vectors
Daniel Neilson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 11:34:36 PST 2018
dneilson created this revision.
dneilson added reviewers: DaniilSuchkov, anna.
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().
Repository:
rL LLVM
https://reviews.llvm.org/D42653
Files:
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
test/Transforms/RewriteStatepointsForGC/base-vector.ll
Index: test/Transforms/RewriteStatepointsForGC/base-vector.ll
===================================================================
--- test/Transforms/RewriteStatepointsForGC/base-vector.ll
+++ test/Transforms/RewriteStatepointsForGC/base-vector.ll
@@ -261,3 +261,19 @@
call void @use_vec(<4 x i64 addrspace(1) *> %vec2)
ret void
}
+
+declare <4 x i64 addrspace(1)*> @def_vec() "gc-leaf-function"
+
+define void @test12(<4 x i64 addrspace(1)*> %vec1) gc "statepoint-example" {
+; CHECK-LABEL: @test12(
+; CHECK: @llvm.experimental.gc.statepoint.p0f_isVoidf{{.*}}<4 x i64 addrspace(1)*> %vec)
+; CHECK-NEXT: %vec.relocated = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8(
+; CHECK-NEXT: %vec.relocated.casted = bitcast <4 x i8 addrspace(1)*> %vec.relocated to <4 x i64 addrspace(1)*>
+; CHECK-NEXT: call void @use_vec(<4 x i64 addrspace(1)*> %vec.relocated.casted)
+; CHECK-NEXT: ret void
+entry:
+ %vec = call <4 x i64 addrspace(1)*> @def_vec()
+ call void @do_safepoint() [ "deopt"() ]
+ call void @use_vec(<4 x i64 addrspace(1)*> %vec)
+ ret void
+}
Index: lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
===================================================================
--- lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -476,6 +476,12 @@
if (auto *BC = dyn_cast<BitCastInst>(I))
return findBaseDefiningValue(BC->getOperand(0));
+ // We assume that functions in the source language only return base
+ // pointers. This should probably be generalized via attributes to support
+ // both source language and internal functions.
+ if (isa<CallInst>(I) || isa<InvokeInst>(I))
+ return BaseDefiningValueResult(I, true);
+
// A PHI or Select is a base defining value. The outer findBasePointer
// algorithm is responsible for constructing a base value for this BDV.
assert((isa<SelectInst>(I) || isa<PHINode>(I)) &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42653.131834.patch
Type: text/x-patch
Size: 1942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180129/a13f7df2/attachment.bin>
More information about the llvm-commits
mailing list