xref: /llvm-project/llvm/test/Transforms/RewriteStatepointsForGC/vector-bitcast.ll (revision a1358225c5b791fa9d901e74fb09606189c0e6af)
1; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s
2;
3; A test to make sure that we can look through bitcasts of
4; vector types when a base pointer is contained in a vector.
5
6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
7target triple = "x86_64-unknown-linux-gnu"
8
9declare ptr addrspace(1) @foo()
10
11; Function Attrs: uwtable
12define i32 @test() gc "statepoint-example" {
13; CHECK-LABEL: @test
14entry:
15; CHECK-LABEL: entry
16; CHECK: %bc = bitcast
17; CHECK: %[[p1:[A-Za-z0-9_.]+]] = extractelement
18; CHECK: %[[p2:[A-Za-z0-9_]+]] = extractelement
19; CHECK: llvm.experimental.gc.statepoint
20; CHECK: %[[p2]].relocated = {{.+}} @llvm.experimental.gc.relocate
21; CHECK: %[[p1]].relocated = {{.+}} @llvm.experimental.gc.relocate
22; CHECK: load atomic
23  %bc = bitcast <8 x ptr addrspace(1)> undef to <8 x ptr addrspace(1)>
24  %ptr= extractelement <8 x ptr addrspace(1)> %bc, i32 7
25  %0 = call ptr addrspace(1) @foo() [ "deopt"() ]
26  %1 = load atomic i32, ptr addrspace(1) %ptr unordered, align 4
27  ret i32 %1
28}
29