1 ; RUN: opt -S -passes=globalsplit %s | FileCheck %s
3 target datalayout = "e-p:64:64"
4 target triple = "x86_64-unknown-linux-gnu"
6 ; CHECK: @vtt = constant [3 x ptr] [ptr @global.0, ptr getelementptr inbounds ([2 x ptr], ptr @global.0, i32 0, i32 1), ptr @global.1]
7 @vtt = constant [3 x ptr] [
8 ptr getelementptr ({ [2 x ptr], [1 x ptr] }, ptr @global, i32 0, inrange i32 0, i32 0),
9 ptr getelementptr ({ [2 x ptr], [1 x ptr] }, ptr @global, i32 0, inrange i32 0, i32 1),
10 ptr getelementptr ({ [2 x ptr], [1 x ptr] }, ptr @global, i32 0, inrange i32 1, i32 0)
13 ; CHECK-NOT: @global =
14 ; CHECK: @global.0 = private constant [2 x ptr] [ptr @f1, ptr @f2], !type [[T1:![0-9]+]], !type [[T2:![0-9]+]], !type [[T3:![0-9]+]], !vcall_visibility [[VIS:![0-9]+]]{{$}}
15 ; CHECK: @global.1 = private constant [1 x ptr] [ptr @f3], !type [[T4:![0-9]+]], !type [[T5:![0-9]+]], !vcall_visibility [[VIS]]{{$}}
16 ; CHECK-NOT: @global =
17 @global = internal constant { [2 x ptr], [1 x ptr] } {
18 [2 x ptr] [ptr @f1, ptr @f2],
20 }, !type !0, !type !1, !type !2, !type !3, !type !4, !vcall_visibility !5
22 ; CHECK: define ptr @f1()
24 ; CHECK-NEXT: ret ptr @global.0
25 ret ptr getelementptr ({ [2 x ptr], [1 x ptr] }, ptr @global, i32 0, inrange i32 0, i32 0)
28 ; CHECK: define ptr @f2()
30 ; CHECK-NEXT: ret ptr getelementptr inbounds ([2 x ptr], ptr @global.0, i32 0, i32 1)
31 ret ptr getelementptr ({ [2 x ptr], [1 x ptr] }, ptr @global, i32 0, inrange i32 0, i32 1)
34 ; CHECK: define ptr @f3()
36 ; CHECK-NEXT: ret ptr getelementptr inbounds ([2 x ptr], ptr @global.0, i64 1, i32 0)
37 ret ptr getelementptr ({ [2 x ptr], [1 x ptr] }, ptr @global, i32 0, inrange i32 0, i32 2)
40 ; CHECK: define ptr @f4()
42 ; CHECK-NEXT: ret ptr @global.1
43 ret ptr getelementptr ({ [2 x ptr], [1 x ptr] }, ptr @global, i32 0, inrange i32 1, i32 0)
47 %p = call i1 @llvm.type.test(ptr null, metadata !"")
51 declare i1 @llvm.type.test(ptr, metadata) nounwind readnone
53 ; CHECK: [[T1]] = !{i32 0, !"foo"}
54 ; CHECK: [[T2]] = !{i32 15, !"bar"}
55 ; CHECK: [[T3]] = !{i32 16, !"a"}
56 ; CHECK: [[VIS]] = !{i64 2}
57 ; CHECK: [[T4]] = !{i32 1, !"b"}
58 ; CHECK: [[T5]] = !{i32 8, !"c"}
60 !1 = !{i32 15, !"bar"}