3 ; RUN: llvm-lto2 run -o %t.o %t.bc -save-temps \
8 ; RUN: llvm-readelf --symbols %t.o.0 | grep \.cfi_jt | FileCheck --check-prefix=CHECK-FULL-RE %s
9 ; RUN: llvm-objdump -dr %t.o.0 | FileCheck --check-prefix=CHECK-FULL-OD %s
10 ; RUN: llvm-dis %t.o.0.4.opt.bc -o - | FileCheck --check-prefix=CHECK-USED %s
12 ; RUN: opt -thinlto-bc -thinlto-split-lto-unit %s -o %t.bc
13 ; RUN: llvm-lto2 run -o %t.o %t.bc \
14 ; RUN: -r=%t.bc,a,px \
15 ; RUN: -r=%t.bc,b,px \
16 ; RUN: -r=%t.bc,c,px \
18 ; RUN: llvm-readelf --symbols %t.o.0 | grep \.cfi_jt | FileCheck --check-prefix=CHECK-THIN-RE %s
19 ; RUN: llvm-objdump -dr %t.o.0 | FileCheck --check-prefix=CHECK-THIN-OD %s
21 ; CHECK-FULL-RE: FUNC LOCAL DEFAULT {{[0-9]+}} a.cfi_jt
22 ; CHECK-FULL-RE-NEXT: FUNC LOCAL DEFAULT {{[0-9]+}} b.cfi_jt
23 ; CHECK-FULL-RE-NEXT: FUNC LOCAL DEFAULT {{[0-9]+}} c.cfi_jt
25 ; CHECK-THIN-RE: FUNC GLOBAL HIDDEN {{[0-9]+}} b.cfi_jt
26 ; CHECK-THIN-RE-NEXT: FUNC GLOBAL HIDDEN {{[0-9]+}} c.cfi_jt
27 ; CHECK-THIN-RE-NEXT: FUNC GLOBAL HIDDEN {{[0-9]+}} a.cfi_jt
29 ; CHECK-FULL-OD: a.cfi_jt>:
30 ; CHECK-FULL-OD: jmp {{.*}} <a.cfi_jt
31 ; CHECK-FULL-OD-NEXT: R_X86_64_PLT32 .La$local
32 ; CHECK-FULL-OD: b.cfi_jt>:
33 ; CHECK-FULL-OD: jmp {{.*}} <b.cfi_jt
34 ; CHECK-FULL-OD-NEXT: R_X86_64_PLT32 .Lb$local
35 ; CHECK-FULL-OD: c.cfi_jt>:
36 ; CHECK-FULL-OD: jmp {{.*}} <c.cfi_jt
37 ; CHECK-FULL-OD-NEXT: R_X86_64_PLT32 .Lc$local
39 ; CHECK-THIN-OD: b.cfi_jt>:
40 ; CHECK-THIN-OD: jmp {{.*}} <b.cfi_jt
41 ; CHECK-THIN-OD-NEXT: R_X86_64_PLT32 b
42 ; CHECK-THIN-OD: c.cfi_jt>:
43 ; CHECK-THIN-OD: jmp {{.*}} <c.cfi_jt
44 ; CHECK-THIN-OD-NEXT: R_X86_64_PLT32 c
45 ; CHECK-THIN-OD: a.cfi_jt>:
46 ; CHECK-THIN-OD: jmp {{.*}} <a.cfi_jt
47 ; CHECK-THIN-OD-NEXT: R_X86_64_PLT32 a
49 ; CHECK-USED: @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @a.cfi_jt to i8*), i8* bitcast (void ()* @b.cfi_jt to i8*), i8* bitcast (void ()* @c.cfi_jt to i8*)], section "llvm.metadata"
51 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
52 target triple = "x86_64-unknown-linux-gnu"
54 @f = internal global [4 x void ()*] [void ()* @a, void ()* @b, void ()* @c, void ()* null], align 16
56 define dso_local void @a() !type !5 !type !6 { ret void }
57 define dso_local void @b() !type !5 !type !6 { ret void }
58 define dso_local void @c() !type !5 !type !6 { ret void }
60 define dso_local void @d() !type !5 !type !6 {
62 %i = alloca i32, align 4
63 store i32 0, i32* %i, align 4
66 for.cond: ; preds = %for.inc, %entry
67 %0 = load i32, i32* %i, align 4
68 %idxprom = sext i32 %0 to i64
69 %arrayidx = getelementptr inbounds [4 x void ()*], [4 x void ()*]* @f, i64 0, i64 %idxprom
70 %1 = load void ()*, void ()** %arrayidx, align 8
71 %tobool = icmp ne void ()* %1, null
72 br i1 %tobool, label %for.body, label %for.end
74 for.body: ; preds = %for.cond
75 %2 = load i32, i32* %i, align 4
76 %idxprom1 = sext i32 %2 to i64
77 %arrayidx2 = getelementptr inbounds [4 x void ()*], [4 x void ()*]* @f, i64 0, i64 %idxprom1
78 %3 = load void ()*, void ()** %arrayidx2, align 8
79 %4 = bitcast void ()* %3 to i8*, !nosanitize !7
80 %5 = call i1 @llvm.type.test(i8* %4, metadata !"_ZTSFvvE"), !nosanitize !7
81 br i1 %5, label %cont, label %trap, !nosanitize !7
83 trap: ; preds = %for.body
84 call void @llvm.ubsantrap(i8 2), !nosanitize !7
85 unreachable, !nosanitize !7
87 cont: ; preds = %for.body
91 for.inc: ; preds = %cont
92 %6 = load i32, i32* %i, align 4
93 %inc = add nsw i32 %6, 1
94 store i32 %inc, i32* %i, align 4
97 for.end: ; preds = %for.cond
101 declare i1 @llvm.type.test(i8*, metadata)
102 declare void @llvm.ubsantrap(i8 immarg)
104 !llvm.module.flags = !{!0, !1, !2, !3}
106 !0 = !{i32 1, !"wchar_size", i32 4}
107 !1 = !{i32 4, !"CFI Canonical Jump Tables", i32 0}
108 !2 = !{i32 7, !"uwtable", i32 1}
109 !3 = !{i32 7, !"frame-pointer", i32 2}
110 !5 = !{i64 0, !"_ZTSFvvE"}
111 !6 = !{i64 0, !"_ZTSFvvE.generalized"}