1 ; RUN: opt -S -cross-dso-cfi < %s | FileCheck %s 2 3 ; CHECK: define void @__cfi_check(i64 %[[TYPE:.*]], i8* %[[ADDR:.*]]) align 4096 4 ; CHECK: switch i64 %[[TYPE]], label %[[TRAP:.*]] [ 5 ; CHECK-NEXT: i64 111, label %[[L1:.*]] 6 ; CHECK-NEXT: i64 222, label %[[L2:.*]] 7 ; CHECK-NEXT: i64 333, label %[[L3:.*]] 8 ; CHECK-NEXT: i64 444, label %[[L4:.*]] 9 ; CHECK-NEXT: {{]$}} 10 11 ; CHECK: [[TRAP]]: 12 ; CHECK-NEXT: call void @llvm.trap() 13 ; CHECK-MEXT: unreachable 14 15 ; CHECK: [[EXIT:.*]]: 16 ; CHECK-NEXT: ret void 17 18 ; CHECK: [[L1]]: 19 ; CHECK-NEXT: call i1 @llvm.bitset.test(i8* %[[ADDR]], metadata i64 111) 20 ; CHECK-NEXT: br {{.*}} label %[[EXIT]], label %[[TRAP]] 21 22 ; CHECK: [[L2]]: 23 ; CHECK-NEXT: call i1 @llvm.bitset.test(i8* %[[ADDR]], metadata i64 222) 24 ; CHECK-NEXT: br {{.*}} label %[[EXIT]], label %[[TRAP]] 25 26 ; CHECK: [[L3]]: 27 ; CHECK-NEXT: call i1 @llvm.bitset.test(i8* %[[ADDR]], metadata i64 333) 28 ; CHECK-NEXT: br {{.*}} label %[[EXIT]], label %[[TRAP]] 29 30 ; CHECK: [[L4]]: 31 ; CHECK-NEXT: call i1 @llvm.bitset.test(i8* %[[ADDR]], metadata i64 444) 32 ; CHECK-NEXT: br {{.*}} label %[[EXIT]], label %[[TRAP]] 33 34 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 35 target triple = "x86_64-unknown-linux-gnu" 36 37 @_ZTV1A = constant i8 0 38 @_ZTI1A = constant i8 0 39 @_ZTS1A = constant i8 0 40 @_ZTV1B = constant i8 0 41 @_ZTI1B = constant i8 0 42 @_ZTS1B = constant i8 0 43 44 define signext i8 @f11() { 45 entry: 46 ret i8 1 47 } 48 49 define signext i8 @f12() { 50 entry: 51 ret i8 2 52 } 53 54 define signext i8 @f13() { 55 entry: 56 ret i8 3 57 } 58 59 define i32 @f21() { 60 entry: 61 ret i32 4 62 } 63 64 define i32 @f22() { 65 entry: 66 ret i32 5 67 } 68 69 !llvm.bitsets = !{!0, !1, !2, !3, !4, !7, !8, !9, !10, !11, !12, !13, !14, !15} 70 !llvm.module.flags = !{!17} 71 72 !0 = !{!"_ZTSFcvE", i8 ()* @f11, i64 0} 73 !1 = !{i64 111, i8 ()* @f11, i64 0} 74 !2 = !{!"_ZTSFcvE", i8 ()* @f12, i64 0} 75 !3 = !{i64 111, i8 ()* @f12, i64 0} 76 !4 = !{!"_ZTSFcvE", i8 ()* @f13, i64 0} 77 !5 = !{i64 111, i8 ()* @f13, i64 0} 78 !6 = !{!"_ZTSFivE", i32 ()* @f21, i64 0} 79 !7 = !{i64 222, i32 ()* @f21, i64 0} 80 !8 = !{!"_ZTSFivE", i32 ()* @f22, i64 0} 81 !9 = !{i64 222, i32 ()* @f22, i64 0} 82 !10 = !{!"_ZTS1A", i8* @_ZTV1A, i64 16} 83 !11 = !{i64 333, i8* @_ZTV1A, i64 16} 84 !12 = !{!"_ZTS1A", i8* @_ZTV1B, i64 16} 85 !13 = !{i64 333, i8* @_ZTV1B, i64 16} 86 !14 = !{!"_ZTS1B", i8* @_ZTV1B, i64 16} 87 !15 = !{i64 444, i8* @_ZTV1B, i64 16} 88 !17= !{i32 4, !"Cross-DSO CFI", i32 1} 89