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