1 ; RUN: opt -S -cross-dso-cfi < %s | FileCheck %s
2 ; RUN: opt -S -passes=cross-dso-cfi < %s | FileCheck %s
4 ; CHECK: define void @__cfi_check(i64 %[[TYPE:.*]], i8* %[[ADDR:.*]], i8* %[[DATA:.*]]) align 4096
5 ; CHECK: switch i64 %[[TYPE]], label %[[FAIL:.*]] [
6 ; CHECK-NEXT: i64 111, label %[[L1:.*]]
7 ; CHECK-NEXT: i64 222, label %[[L2:.*]]
8 ; CHECK-NEXT: i64 333, label %[[L3:.*]]
9 ; CHECK-NEXT: i64 444, label %[[L4:.*]]
13 ; CHECK-NEXT: ret void
16 ; CHECK-NEXT: call void @__cfi_check_fail(i8* %[[DATA]], i8* %[[ADDR]])
17 ; CHECK-NEXT: br label %[[EXIT]]
20 ; CHECK-NEXT: call i1 @llvm.type.test(i8* %[[ADDR]], metadata i64 111)
21 ; CHECK-NEXT: br {{.*}} label %[[EXIT]], label %[[FAIL]]
24 ; CHECK-NEXT: call i1 @llvm.type.test(i8* %[[ADDR]], metadata i64 222)
25 ; CHECK-NEXT: br {{.*}} label %[[EXIT]], label %[[FAIL]]
28 ; CHECK-NEXT: call i1 @llvm.type.test(i8* %[[ADDR]], metadata i64 333)
29 ; CHECK-NEXT: br {{.*}} label %[[EXIT]], label %[[FAIL]]
32 ; CHECK-NEXT: call i1 @llvm.type.test(i8* %[[ADDR]], metadata i64 444)
33 ; CHECK-NEXT: br {{.*}} label %[[EXIT]], label %[[FAIL]]
35 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
36 target triple = "x86_64-unknown-linux-gnu"
38 @_ZTV1A = constant i8 0, !type !4, !type !5
39 @_ZTV1B = constant i8 0, !type !4, !type !5, !type !6, !type !7
41 define signext i8 @f11() !type !0 !type !1 {
46 define signext i8 @f12() !type !0 !type !1 {
51 define signext i8 @f13() !type !0 !type !1 {
56 define i32 @f21() !type !2 !type !3 {
61 define i32 @f22() !type !2 !type !3 {
66 define weak_odr hidden void @__cfi_check_fail(i8*, i8*) {
71 !llvm.module.flags = !{!8}
73 !0 = !{i64 0, !"_ZTSFcvE"}
74 !1 = !{i64 0, i64 111}
75 !2 = !{i64 0, !"_ZTSFivE"}
76 !3 = !{i64 0, i64 222}
77 !4 = !{i64 16, !"_ZTS1A"}
78 !5 = !{i64 16, i64 333}
79 !6 = !{i64 16, !"_ZTS1B"}
80 !7 = !{i64 16, i64 444}
81 !8 = !{i32 4, !"Cross-DSO CFI", i32 1}