|
| 1 | +; ModuleID = 'clang/test/CodeGen/cfi-check-fail-debuginfo.c' |
| 2 | +source_filename = "clang/test/CodeGen/cfi-check-fail-debuginfo.c" |
| 3 | +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" |
| 4 | +target triple = "x86_64-unknown-linux" |
| 5 | + |
| 6 | +@llvm.used = appending global [1 x ptr] [ptr @__cfi_check_fail], section "llvm.metadata" |
| 7 | + |
| 8 | +; Function Attrs: nounwind |
| 9 | +define dso_local void @caller(ptr noundef %f) local_unnamed_addr #0 !dbg !7 !type !16 !type !17 !type !18 { |
| 10 | +entry: |
| 11 | + #dbg_value(ptr %f, !15, !DIExpression(), !19) |
| 12 | + %0 = tail call i1 @llvm.type.test(ptr %f, metadata !"_ZTSFvvE"), !dbg !20, !nosanitize !24 |
| 13 | + br i1 %0, label %cfi.cont, label %cfi.slowpath, !dbg !20, !prof !25, !nosanitize !24 |
| 14 | + |
| 15 | +cfi.slowpath: ; preds = %entry |
| 16 | + tail call void @__cfi_slowpath(i64 9080559750644022485, ptr %f) #6, !dbg !20, !nosanitize !24 |
| 17 | + br label %cfi.cont, !dbg !20, !nosanitize !24 |
| 18 | + |
| 19 | +cfi.cont: ; preds = %cfi.slowpath, %entry |
| 20 | + tail call void %f() #6, !dbg !23 |
| 21 | + ret void, !dbg !26 |
| 22 | +} |
| 23 | + |
| 24 | +; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) |
| 25 | +declare i1 @llvm.type.test(ptr, metadata) #1 |
| 26 | + |
| 27 | +declare void @__cfi_slowpath(i64, ptr) local_unnamed_addr |
| 28 | + |
| 29 | +; Function Attrs: nounwind |
| 30 | +define weak_odr hidden void @__cfi_check_fail(ptr noundef %0, ptr noundef %1) #0 !dbg !27 { |
| 31 | +entry: |
| 32 | + #dbg_value(ptr %0, !30, !DIExpression(), !33) |
| 33 | + #dbg_value(ptr %1, !32, !DIExpression(), !33) |
| 34 | + %.not = icmp eq ptr %0, null, !dbg !33, !nosanitize !24 |
| 35 | + br i1 %.not, label %trap, label %cont, !dbg !33, !prof !34, !nosanitize !24 |
| 36 | + |
| 37 | +trap: ; preds = %entry |
| 38 | + tail call void @llvm.ubsantrap(i8 2) #7, !dbg !33, !nosanitize !24 |
| 39 | + unreachable, !dbg !33, !nosanitize !24 |
| 40 | + |
| 41 | +cont: ; preds = %entry |
| 42 | + %2 = load i8, ptr %0, align 4, !dbg !33, !nosanitize !24 |
| 43 | + %3 = tail call i1 @llvm.type.test(ptr %1, metadata !"all-vtables"), !dbg !33, !nosanitize !24 |
| 44 | + %4 = zext i1 %3 to i64, !dbg !33, !nosanitize !24 |
| 45 | + switch i8 %2, label %cont10 [ |
| 46 | + i8 0, label %handler.cfi_check_fail |
| 47 | + i8 1, label %trap3 |
| 48 | + i8 2, label %handler.cfi_check_fail5 |
| 49 | + i8 3, label %handler.cfi_check_fail7 |
| 50 | + i8 4, label %trap9 |
| 51 | + ], !dbg !33, !prof !35 |
| 52 | + |
| 53 | +handler.cfi_check_fail: ; preds = %cont |
| 54 | + %5 = ptrtoint ptr %0 to i64, !dbg !33, !nosanitize !24 |
| 55 | + %6 = ptrtoint ptr %1 to i64, !dbg !33, !nosanitize !24 |
| 56 | + tail call void @__ubsan_handle_cfi_check_fail(i64 %5, i64 %6, i64 %4) #8, !dbg !33, !nosanitize !24 |
| 57 | + br label %cont10, !dbg !33 |
| 58 | + |
| 59 | +trap3: ; preds = %cont |
| 60 | + tail call void @llvm.ubsantrap(i8 2) #9, !dbg !33, !nosanitize !24 |
| 61 | + unreachable, !dbg !33, !nosanitize !24 |
| 62 | + |
| 63 | +handler.cfi_check_fail5: ; preds = %cont |
| 64 | + %7 = ptrtoint ptr %0 to i64, !dbg !33, !nosanitize !24 |
| 65 | + %8 = ptrtoint ptr %1 to i64, !dbg !33, !nosanitize !24 |
| 66 | + tail call void @__ubsan_handle_cfi_check_fail_abort(i64 %7, i64 %8, i64 %4) #9, !dbg !33, !nosanitize !24 |
| 67 | + unreachable, !dbg !33, !nosanitize !24 |
| 68 | + |
| 69 | +handler.cfi_check_fail7: ; preds = %cont |
| 70 | + %9 = ptrtoint ptr %0 to i64, !dbg !33, !nosanitize !24 |
| 71 | + %10 = ptrtoint ptr %1 to i64, !dbg !33, !nosanitize !24 |
| 72 | + tail call void @__ubsan_handle_cfi_check_fail(i64 %9, i64 %10, i64 %4) #8, !dbg !33, !nosanitize !24 |
| 73 | + br label %cont10, !dbg !33 |
| 74 | + |
| 75 | +trap9: ; preds = %cont |
| 76 | + tail call void @llvm.ubsantrap(i8 2) #9, !dbg !33, !nosanitize !24 |
| 77 | + unreachable, !dbg !33, !nosanitize !24 |
| 78 | + |
| 79 | +cont10: ; preds = %handler.cfi_check_fail7, %handler.cfi_check_fail, %cont |
| 80 | + ret void, !dbg !33, !nosanitize !24 |
| 81 | +} |
| 82 | + |
| 83 | +; Function Attrs: cold noreturn nounwind |
| 84 | +declare void @llvm.ubsantrap(i8 immarg) #2 |
| 85 | + |
| 86 | +; Function Attrs: uwtable |
| 87 | +declare void @__ubsan_handle_cfi_check_fail(i64, i64, i64) local_unnamed_addr #3 |
| 88 | + |
| 89 | +; Function Attrs: noreturn nounwind uwtable |
| 90 | +declare void @__ubsan_handle_cfi_check_fail_abort(i64, i64, i64) local_unnamed_addr #4 |
| 91 | + |
| 92 | +; Function Attrs: nounwind |
| 93 | +define weak void @__cfi_check(i64 noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #5 align 4096 { |
| 94 | +entry: |
| 95 | + #dbg_value(ptr %2, !30, !DIExpression(), !33) |
| 96 | + #dbg_value(ptr %1, !32, !DIExpression(), !33) |
| 97 | + %.not.i = icmp eq ptr %2, null, !dbg !33, !nosanitize !24 |
| 98 | + br i1 %.not.i, label %trap.i, label %cont.i, !dbg !33, !prof !34, !nosanitize !24 |
| 99 | + |
| 100 | +trap.i: ; preds = %entry |
| 101 | + tail call void @llvm.ubsantrap(i8 2) #7, !dbg !33, !nosanitize !24 |
| 102 | + unreachable, !dbg !33, !nosanitize !24 |
| 103 | + |
| 104 | +cont.i: ; preds = %entry |
| 105 | + %3 = load i8, ptr %2, align 4, !dbg !33, !nosanitize !24 |
| 106 | + %4 = tail call i1 @llvm.type.test(ptr %1, metadata !"all-vtables"), !dbg !33, !nosanitize !24 |
| 107 | + %5 = zext i1 %4 to i64, !dbg !33, !nosanitize !24 |
| 108 | + switch i8 %3, label %__cfi_check_fail.exit [ |
| 109 | + i8 0, label %handler.cfi_check_fail.i |
| 110 | + i8 1, label %trap3.i |
| 111 | + i8 2, label %handler.cfi_check_fail5.i |
| 112 | + i8 3, label %handler.cfi_check_fail7.i |
| 113 | + i8 4, label %trap9.i |
| 114 | + ], !dbg !33, !prof !35 |
| 115 | + |
| 116 | +handler.cfi_check_fail.i: ; preds = %cont.i |
| 117 | + %6 = ptrtoint ptr %2 to i64, !dbg !33, !nosanitize !24 |
| 118 | + %7 = ptrtoint ptr %1 to i64, !dbg !33, !nosanitize !24 |
| 119 | + tail call void @__ubsan_handle_cfi_check_fail(i64 %6, i64 %7, i64 %5) #8, !dbg !33, !nosanitize !24 |
| 120 | + br label %__cfi_check_fail.exit, !dbg !33 |
| 121 | + |
| 122 | +trap3.i: ; preds = %cont.i |
| 123 | + tail call void @llvm.ubsantrap(i8 2) #9, !dbg !33, !nosanitize !24 |
| 124 | + unreachable, !dbg !33, !nosanitize !24 |
| 125 | + |
| 126 | +handler.cfi_check_fail5.i: ; preds = %cont.i |
| 127 | + %8 = ptrtoint ptr %2 to i64, !dbg !33, !nosanitize !24 |
| 128 | + %9 = ptrtoint ptr %1 to i64, !dbg !33, !nosanitize !24 |
| 129 | + tail call void @__ubsan_handle_cfi_check_fail_abort(i64 %8, i64 %9, i64 %5) #9, !dbg !33, !nosanitize !24 |
| 130 | + unreachable, !dbg !33, !nosanitize !24 |
| 131 | + |
| 132 | +handler.cfi_check_fail7.i: ; preds = %cont.i |
| 133 | + %10 = ptrtoint ptr %2 to i64, !dbg !33, !nosanitize !24 |
| 134 | + %11 = ptrtoint ptr %1 to i64, !dbg !33, !nosanitize !24 |
| 135 | + tail call void @__ubsan_handle_cfi_check_fail(i64 %10, i64 %11, i64 %5) #8, !dbg !33, !nosanitize !24 |
| 136 | + br label %__cfi_check_fail.exit, !dbg !33 |
| 137 | + |
| 138 | +trap9.i: ; preds = %cont.i |
| 139 | + tail call void @llvm.ubsantrap(i8 2) #9, !dbg !33, !nosanitize !24 |
| 140 | + unreachable, !dbg !33, !nosanitize !24 |
| 141 | + |
| 142 | +__cfi_check_fail.exit: ; preds = %cont.i, %handler.cfi_check_fail.i, %handler.cfi_check_fail7.i |
| 143 | + ret void |
| 144 | +} |
| 145 | + |
| 146 | +attributes #0 = { nounwind "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" } |
| 147 | +attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } |
| 148 | +attributes #2 = { cold noreturn nounwind } |
| 149 | +attributes #3 = { uwtable } |
| 150 | +attributes #4 = { noreturn nounwind uwtable } |
| 151 | +attributes #5 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" } |
| 152 | +attributes #6 = { nounwind } |
| 153 | +attributes #7 = { noreturn nounwind } |
| 154 | +attributes #8 = { nomerge nounwind } |
| 155 | +attributes #9 = { nomerge noreturn nounwind } |
| 156 | + |
| 157 | +!llvm.dbg.cu = !{!0} |
| 158 | +!llvm.module.flags = !{!2, !3, !4, !5, !6} |
| 159 | + |
| 160 | +!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) |
| 161 | +!1 = !DIFile(filename: "<stdin>", directory: "clang/test/CodeGen") |
| 162 | +!2 = !{i32 2, !"Debug Info Version", i32 3} |
| 163 | +!3 = !{i32 1, !"wchar_size", i32 4} |
| 164 | +!4 = !{i32 4, !"Cross-DSO CFI", i32 1} |
| 165 | +!5 = !{i32 4, !"CFI Canonical Jump Tables", i32 0} |
| 166 | +!6 = !{i32 7, !"debug-info-assignment-tracking", i1 true} |
| 167 | +!7 = distinct !DISubprogram(name: "caller", scope: !8, file: !8, line: 22, type: !9, scopeLine: 22, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14) |
| 168 | +!8 = !DIFile(filename: "cfi-check-fail-debuginfo.c", directory: "clang/test/CodeGen") |
| 169 | +!9 = !DISubroutineType(types: !10) |
| 170 | +!10 = !{null, !11} |
| 171 | +!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64) |
| 172 | +!12 = !DISubroutineType(types: !13) |
| 173 | +!13 = !{null} |
| 174 | +!14 = !{!15} |
| 175 | +!15 = !DILocalVariable(name: "f", arg: 1, scope: !7, file: !8, line: 22, type: !11) |
| 176 | +!16 = !{i64 0, !"_ZTSFvPFvvEE"} |
| 177 | +!17 = !{i64 0, !"_ZTSFvPvE.generalized"} |
| 178 | +!18 = !{i64 0, i64 2451761621477796417} |
| 179 | +!19 = !DILocation(line: 0, scope: !7) |
| 180 | +!20 = !DILocation(line: 0, scope: !21, inlinedAt: !23) |
| 181 | +!21 = distinct !DISubprogram(name: "__ubsan_check_cfi_icall", scope: !8, file: !8, type: !22, flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: !0) |
| 182 | +!22 = !DISubroutineType(types: null) |
| 183 | +!23 = !DILocation(line: 23, column: 3, scope: !7) |
| 184 | +!24 = !{} |
| 185 | +!25 = !{!"branch_weights", i32 1048575, i32 1} |
| 186 | +!26 = !DILocation(line: 24, column: 1, scope: !7) |
| 187 | +!27 = distinct !DISubprogram(linkageName: "__cfi_check_fail", scope: !1, file: !1, type: !28, flags: DIFlagArtificial, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !29) |
| 188 | +!28 = !DISubroutineType(types: !24) |
| 189 | +!29 = !{!30, !32} |
| 190 | +!30 = !DILocalVariable(arg: 1, scope: !27, type: !31, flags: DIFlagArtificial) |
| 191 | +!31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) |
| 192 | +!32 = !DILocalVariable(arg: 2, scope: !27, type: !31, flags: DIFlagArtificial) |
| 193 | +!33 = !DILocation(line: 0, scope: !27) |
| 194 | +!34 = !{!"branch_weights", i32 1, i32 1048575} |
| 195 | +!35 = !{!"branch_weights", i32 -20480, i32 4096, i32 4095, i32 4095, i32 4095, i32 4095} |
0 commit comments