llvm.org GIT mirror llvm / 8e740f1
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298028 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjoy Das 2 years ago
2 changed file(s) with 20 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
363363 // TODO: There a number of local optimizations which could be applied here
364364 // for particular sufflevector patterns.
365365 return BaseDefiningValueResult(I, false);
366
367 // The behavior of getelementptr instructions is the same for vector and
368 // non-vector data types.
369 if (auto *GEP = dyn_cast(I))
370 return findBaseDefiningValue(GEP->getPointerOperand());
366371
367372 // A PHI or Select is a base defining value. The outer findBasePointer
368373 // algorithm is responsible for constructing a base value for this BDV.
8787 }
8888
8989 declare void @use(i64 addrspace(1)*) "gc-leaf-function"
90 declare void @use_vec(<4 x i64 addrspace(1)*>) "gc-leaf-function"
9091
9192 define void @test5(i1 %cnd, i64 addrspace(1)* %obj) gc "statepoint-example" {
9293 ; CHECK-LABEL: @test5
244245 ret i64 addrspace(1)* %bdv
245246 }
246247 declare void @do_safepoint()
248
249 define void @test11(<4 x i64 addrspace(1)*> %vec1) gc "statepoint-example" {
250 ; CHECK-LABEL: @test11(
251 ; CHECK: @llvm.experimental.gc.statepoint.p0f_isVoidf{{.*}}<4 x i64 addrspace(1)*> %vec1)
252 ; CHECK: %vec1.relocated = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8
253 ; CHECK: %vec1.relocated.casted = bitcast <4 x i8 addrspace(1)*> %vec1.relocated to <4 x i64 addrspace(1)*>
254 ; CHECK: %vec2.remat = getelementptr i64, <4 x i64 addrspace(1)*> %vec1.relocated.casted, i32 1024
255 ; CHECK: call void @use_vec(<4 x i64 addrspace(1)*> %vec2.remat)
256 entry:
257 %vec2 = getelementptr i64, <4 x i64 addrspace(1)*> %vec1, i32 1024
258 call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
259 call void @use_vec(<4 x i64 addrspace(1) *> %vec2)
260 ret void
261 }