1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[RSForGC] Handle vector GEPs

We were not handling getelemenptr instructions of vector type before.
Since getelemenptr instructions for vector types follow the same rule as
getelementptr instructions for non-vector types, we can just handle them
in the same way.

llvm-svn: 298028
This commit is contained in:
Sanjoy Das 2017-03-17 00:55:53 +00:00
parent 68d368b8f9
commit 122a772af6
2 changed files with 20 additions and 0 deletions

View File

@ -365,6 +365,11 @@ findBaseDefiningValueOfVector(Value *I) {
// for particular sufflevector patterns.
return BaseDefiningValueResult(I, false);
// The behavior of getelementptr instructions is the same for vector and
// non-vector data types.
if (auto *GEP = dyn_cast<GetElementPtrInst>(I))
return findBaseDefiningValue(GEP->getPointerOperand());
// 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)) &&

View File

@ -88,6 +88,7 @@ entry:
}
declare void @use(i64 addrspace(1)*) "gc-leaf-function"
declare void @use_vec(<4 x i64 addrspace(1)*>) "gc-leaf-function"
define void @test5(i1 %cnd, i64 addrspace(1)* %obj) gc "statepoint-example" {
; CHECK-LABEL: @test5
@ -245,3 +246,17 @@ next:
ret i64 addrspace(1)* %bdv
}
declare void @do_safepoint()
define void @test11(<4 x i64 addrspace(1)*> %vec1) gc "statepoint-example" {
; CHECK-LABEL: @test11(
; CHECK: @llvm.experimental.gc.statepoint.p0f_isVoidf{{.*}}<4 x i64 addrspace(1)*> %vec1)
; CHECK: %vec1.relocated = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8
; CHECK: %vec1.relocated.casted = bitcast <4 x i8 addrspace(1)*> %vec1.relocated to <4 x i64 addrspace(1)*>
; CHECK: %vec2.remat = getelementptr i64, <4 x i64 addrspace(1)*> %vec1.relocated.casted, i32 1024
; CHECK: call void @use_vec(<4 x i64 addrspace(1)*> %vec2.remat)
entry:
%vec2 = getelementptr i64, <4 x i64 addrspace(1)*> %vec1, i32 1024
call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
call void @use_vec(<4 x i64 addrspace(1) *> %vec2)
ret void
}