1cee313d2SEric Christopher; RUN: opt -S -globalsplit %s | FileCheck %s 2cee313d2SEric Christopher; RUN: opt -S -passes=globalsplit %s | FileCheck %s 3cee313d2SEric Christopher 4cee313d2SEric Christophertarget datalayout = "e-p:64:64" 5cee313d2SEric Christophertarget triple = "x86_64-unknown-linux-gnu" 6cee313d2SEric Christopher 7cee313d2SEric Christopher; CHECK: @vtt = constant [3 x i8*] [i8* bitcast ([2 x i8* ()*]* @global.0 to i8*), i8* bitcast (i8* ()** getelementptr inbounds ([2 x i8* ()*], [2 x i8* ()*]* @global.0, i32 0, i32 1) to i8*), i8* bitcast ([1 x i8* ()*]* @global.1 to i8*)] 8cee313d2SEric Christopher@vtt = constant [3 x i8*] [ 9cee313d2SEric Christopher i8* bitcast (i8* ()** getelementptr ({ [2 x i8* ()*], [1 x i8* ()*] }, { [2 x i8* ()*], [1 x i8* ()*] }* @global, i32 0, inrange i32 0, i32 0) to i8*), 10cee313d2SEric Christopher i8* bitcast (i8* ()** getelementptr ({ [2 x i8* ()*], [1 x i8* ()*] }, { [2 x i8* ()*], [1 x i8* ()*] }* @global, i32 0, inrange i32 0, i32 1) to i8*), 11cee313d2SEric Christopher i8* bitcast (i8* ()** getelementptr ({ [2 x i8* ()*], [1 x i8* ()*] }, { [2 x i8* ()*], [1 x i8* ()*] }* @global, i32 0, inrange i32 1, i32 0) to i8*) 12cee313d2SEric Christopher] 13cee313d2SEric Christopher 14cee313d2SEric Christopher; CHECK-NOT: @global = 15*c5d53efeSThomas Preud'homme; CHECK: @global.0 = private constant [2 x i8* ()*] [i8* ()* @f1, i8* ()* @f2], !type [[T1:![0-9]+]], !type [[T2:![0-9]+]], !type [[T3:![0-9]+]], !vcall_visibility [[VIS:![0-9]+]]{{$}} 16*c5d53efeSThomas Preud'homme; CHECK: @global.1 = private constant [1 x i8* ()*] [i8* ()* @f3], !type [[T4:![0-9]+]], !type [[T5:![0-9]+]], !vcall_visibility [[VIS]]{{$}} 17cee313d2SEric Christopher; CHECK-NOT: @global = 18cee313d2SEric Christopher@global = internal constant { [2 x i8* ()*], [1 x i8* ()*] } { 19cee313d2SEric Christopher [2 x i8* ()*] [i8* ()* @f1, i8* ()* @f2], 20cee313d2SEric Christopher [1 x i8* ()*] [i8* ()* @f3] 21458676dbSTeresa Johnson}, !type !0, !type !1, !type !2, !type !3, !type !4, !vcall_visibility !5 22cee313d2SEric Christopher 23cee313d2SEric Christopher; CHECK: define i8* @f1() 24cee313d2SEric Christopherdefine i8* @f1() { 25cee313d2SEric Christopher ; CHECK-NEXT: ret i8* bitcast ([2 x i8* ()*]* @global.0 to i8*) 26cee313d2SEric Christopher ret i8* bitcast (i8* ()** getelementptr ({ [2 x i8* ()*], [1 x i8* ()*] }, { [2 x i8* ()*], [1 x i8* ()*] }* @global, i32 0, inrange i32 0, i32 0) to i8*) 27cee313d2SEric Christopher} 28cee313d2SEric Christopher 29cee313d2SEric Christopher; CHECK: define i8* @f2() 30cee313d2SEric Christopherdefine i8* @f2() { 31cee313d2SEric Christopher ; CHECK-NEXT: ret i8* bitcast (i8* ()** getelementptr inbounds ([2 x i8* ()*], [2 x i8* ()*]* @global.0, i32 0, i32 1) to i8*) 32cee313d2SEric Christopher ret i8* bitcast (i8* ()** getelementptr ({ [2 x i8* ()*], [1 x i8* ()*] }, { [2 x i8* ()*], [1 x i8* ()*] }* @global, i32 0, inrange i32 0, i32 1) to i8*) 33cee313d2SEric Christopher} 34cee313d2SEric Christopher 35cee313d2SEric Christopher; CHECK: define i8* @f3() 36cee313d2SEric Christopherdefine i8* @f3() { 37cee313d2SEric Christopher ; CHECK-NEXT: ret i8* bitcast (i8* ()** getelementptr inbounds ([2 x i8* ()*], [2 x i8* ()*]* @global.0, i64 1, i32 0) to i8*) 38cee313d2SEric Christopher ret i8* bitcast (i8* ()** getelementptr ({ [2 x i8* ()*], [1 x i8* ()*] }, { [2 x i8* ()*], [1 x i8* ()*] }* @global, i32 0, inrange i32 0, i32 2) to i8*) 39cee313d2SEric Christopher} 40cee313d2SEric Christopher 41cee313d2SEric Christopher; CHECK: define i8* @f4() 42cee313d2SEric Christopherdefine i8* @f4() { 43cee313d2SEric Christopher ; CHECK-NEXT: ret i8* bitcast ([1 x i8* ()*]* @global.1 to i8*) 44cee313d2SEric Christopher ret i8* bitcast (i8* ()** getelementptr ({ [2 x i8* ()*], [1 x i8* ()*] }, { [2 x i8* ()*], [1 x i8* ()*] }* @global, i32 0, inrange i32 1, i32 0) to i8*) 45cee313d2SEric Christopher} 46cee313d2SEric Christopher 47cee313d2SEric Christopherdefine void @foo() { 48cee313d2SEric Christopher %p = call i1 @llvm.type.test(i8* null, metadata !"") 49cee313d2SEric Christopher ret void 50cee313d2SEric Christopher} 51cee313d2SEric Christopher 52cee313d2SEric Christopherdeclare i1 @llvm.type.test(i8*, metadata) nounwind readnone 53cee313d2SEric Christopher 54cee313d2SEric Christopher; CHECK: [[T1]] = !{i32 0, !"foo"} 55cee313d2SEric Christopher; CHECK: [[T2]] = !{i32 15, !"bar"} 56cee313d2SEric Christopher; CHECK: [[T3]] = !{i32 16, !"a"} 57458676dbSTeresa Johnson; CHECK: [[VIS]] = !{i64 2} 58cee313d2SEric Christopher; CHECK: [[T4]] = !{i32 1, !"b"} 59cee313d2SEric Christopher; CHECK: [[T5]] = !{i32 8, !"c"} 60cee313d2SEric Christopher!0 = !{i32 0, !"foo"} 61cee313d2SEric Christopher!1 = !{i32 15, !"bar"} 62cee313d2SEric Christopher!2 = !{i32 16, !"a"} 63cee313d2SEric Christopher!3 = !{i32 17, !"b"} 64cee313d2SEric Christopher!4 = !{i32 24, !"c"} 65458676dbSTeresa Johnson!5 = !{i64 2} 66