llvm.org GIT mirror llvm / 043ceff
[RS4GC] Look through vector bitcasts when looking for base pointer Summary: In RS4GC it is possible that a base pointer is contained in a vector that has undergone a bitcast from one element-pointertype to another. We teach RS4GC how to look through bitcasts of vector types when looking for a base pointer. Reviewers: anna Reviewed By: anna Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38849 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315694 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Neilson 1 year, 11 months ago
2 changed file(s) with 31 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
420420 if (auto *GEP = dyn_cast(I))
421421 return findBaseDefiningValue(GEP->getPointerOperand());
422422
423 // If the pointer comes through a bitcast of a vector of pointers to
424 // a vector of another type of pointer, then look through the bitcast
425 if (auto *BC = dyn_cast(I))
426 return findBaseDefiningValue(BC->getOperand(0));
427
423428 // A PHI or Select is a base defining value. The outer findBasePointer
424429 // algorithm is responsible for constructing a base value for this BDV.
425430 assert((isa(I) || isa(I)) &&
0 ; RUN: opt -S -rewrite-statepoints-for-gc < %s | FileCheck %s
1 ;
2 ; A test to make sure that we can look through bitcasts of
3 ; vector types when a base pointer is contained in a vector.
4
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
6 target triple = "x86_64-unknown-linux-gnu"
7
8 ; Function Attrs: uwtable
9 define void @test() gc "statepoint-example" {
10 ; CHECK-LABEL: @test
11 entry:
12 ; CHECK-LABEL: entry
13 ; CHECK: %bc = bitcast
14 ; CHECK: %[[p1:[A-Za-z0-9_]+]] = extractelement
15 ; CHECK: %[[p2:[A-Za-z0-9_]+]] = extractelement
16 ; CHECK: llvm.experimental.gc.statepoint
17 ; CHECK: %[[p2]].relocated = {{.+}} @llvm.experimental.gc.relocate
18 ; CHECK: %[[p1]].relocated = {{.+}} @llvm.experimental.gc.relocate
19 ; CHECK: load atomic
20 %bc = bitcast <8 x i8 addrspace(1)*> undef to <8 x i32 addrspace(1)*>
21 %ptr= extractelement <8 x i32 addrspace(1)*> %bc, i32 7
22 %0 = call i8 addrspace(1)* undef() [ "deopt"() ]
23 %1 = load atomic i32, i32 addrspace(1)* %ptr unordered, align 4
24 unreachable
25 }