1 ; RUN: opt -S -lowertypetests -mtriple=i686-unknown-linux-gnu < %s | FileCheck --check-prefixes=CHECK,X86 %s
2 ; RUN: opt -S -lowertypetests -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck --check-prefixes=CHECK,X86 %s
3 ; RUN: opt -S -lowertypetests -mtriple=arm-unknown-linux-gnu < %s | FileCheck --check-prefixes=CHECK,ARM %s
4 ; RUN: opt -S -lowertypetests -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck --check-prefixes=CHECK,ARM %s
6 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-unknown-linux-gnu"
9 ; CHECK: @x = global void ()* null, align 8
10 @x = global void ()* @f, align 8
12 ; CHECK: @x2 = global void ()* null, align 8
13 @x2 = global void ()* @f, align 8
15 ; CHECK: @x3 = internal global void ()* null, align 8
16 @x3 = internal constant void ()* @f, align 8
19 ; CHECK: @x4 = global void ()* null, align 8
20 @x4 = global void ()* bitcast (i8* getelementptr (i8, i8* bitcast (void ()* @f to i8*), i64 42) to void ()*), align 8
22 ; aggregate initializer
23 ; CHECK: @s = global { void ()*, void ()*, i32 } zeroinitializer, align 8
24 @s = global { void ()*, void ()*, i32 } { void ()* @f, void ()* @f, i32 42 }, align 8
26 ; CHECK: @llvm.global_ctors = appending global {{.*}}{ i32 0, void ()* @__cfi_global_var_init
28 ; CHECK: declare !type !0 extern_weak void @f()
29 declare !type !0 extern_weak void @f()
31 ; CHECK: define zeroext i1 @check_f()
32 define zeroext i1 @check_f() {
34 ; CHECK: ret i1 icmp ne (void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT:.*]], void ()* null), void ()* null)
35 ret i1 icmp ne (void ()* @f, void ()* null)
38 ; CHECK: define void @call_f() {
39 define void @call_f() {
41 ; CHECK: call void @f()
46 declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
48 define i1 @foo(i8* %p) {
49 %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1")
53 ; X86: define private void @[[JT]]() #{{.*}} align 8 {
54 ; ARM: define private void @[[JT]]() #{{.*}} align 4 {
56 ; CHECK: define internal void @__cfi_global_var_init() section ".text.startup" {
58 ; CHECK-NEXT: store { void ()*, void ()*, i32 } { void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null), void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null), i32 42 }, { void ()*, void ()*, i32 }* @s, align 8
59 ; CHECK-NEXT: store void ()* bitcast (i8* getelementptr (i8, i8* bitcast (void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null) to i8*), i64 42) to void ()*), void ()** @x4, align 8
60 ; CHECK-NEXT: store void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null), void ()** @x3, align 8
61 ; CHECK-NEXT: store void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null), void ()** @x2, align 8
62 ; CHECK-NEXT: store void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null), void ()** @x, align 8
63 ; CHECK-NEXT: ret void
66 !0 = !{i32 0, !"typeid1"}