127 lines · plain
1; RUN: opt < %s -passes=add-discriminators -S | FileCheck %s2; ModuleID = 'invoke.bc'3source_filename = "invoke.cpp"4target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"5target triple = "x86_64-apple-macosx10.14.0"6 7; Function Attrs: ssp uwtable8define void @_Z3foov() personality ptr @__gxx_personality_v0 !dbg !8 {9entry:10 %exn.slot = alloca ptr11 %ehselector.slot = alloca i3212 ; CHECK: call void @_Z12bar_noexceptv({{.*}} !dbg ![[CALL1:[0-9]+]]13 call void @_Z12bar_noexceptv(), !dbg !1114 ; CHECK: call void @_Z12bar_noexceptv({{.*}} !dbg ![[CALL2:[0-9]+]]15 call void @_Z12bar_noexceptv(), !dbg !1316 invoke void @_Z3barv()17 ; CHECK: unwind label {{.*}} !dbg ![[INVOKE:[0-9]+]]18 to label %invoke.cont unwind label %lpad, !dbg !1419 20invoke.cont: ; preds = %entry21 br label %try.cont, !dbg !1522 23lpad: ; preds = %entry24 %0 = landingpad { ptr, i32 }25 catch ptr null, !dbg !1626 %1 = extractvalue { ptr, i32 } %0, 0, !dbg !1627 store ptr %1, ptr %exn.slot, align 8, !dbg !1628 %2 = extractvalue { ptr, i32 } %0, 1, !dbg !1629 store i32 %2, ptr %ehselector.slot, align 4, !dbg !1630 br label %catch, !dbg !1631 32catch: ; preds = %lpad33 %exn = load ptr, ptr %exn.slot, align 8, !dbg !1534 %3 = call ptr @__cxa_begin_catch(ptr %exn), !dbg !1535 invoke void @__cxa_rethrow()36 to label %unreachable unwind label %lpad1, !dbg !1737 38lpad1: ; preds = %catch39 %4 = landingpad { ptr, i32 }40 cleanup, !dbg !1941 %5 = extractvalue { ptr, i32 } %4, 0, !dbg !1942 store ptr %5, ptr %exn.slot, align 8, !dbg !1943 %6 = extractvalue { ptr, i32 } %4, 1, !dbg !1944 store i32 %6, ptr %ehselector.slot, align 4, !dbg !1945 invoke void @__cxa_end_catch()46 to label %invoke.cont2 unwind label %terminate.lpad, !dbg !2047 48invoke.cont2: ; preds = %lpad149 br label %eh.resume, !dbg !2050 51try.cont: ; preds = %invoke.cont52 ret void, !dbg !2153 54eh.resume: ; preds = %invoke.cont255 %exn3 = load ptr, ptr %exn.slot, align 8, !dbg !2056 %sel = load i32, ptr %ehselector.slot, align 4, !dbg !2057 %lpad.val = insertvalue { ptr, i32 } poison, ptr %exn3, 0, !dbg !2058 %lpad.val4 = insertvalue { ptr, i32 } %lpad.val, i32 %sel, 1, !dbg !2059 resume { ptr, i32 } %lpad.val4, !dbg !2060 61terminate.lpad: ; preds = %lpad162 %7 = landingpad { ptr, i32 }63 catch ptr null, !dbg !2064 %8 = extractvalue { ptr, i32 } %7, 0, !dbg !2065 call void @__clang_call_terminate(ptr %8), !dbg !2066 unreachable, !dbg !2067 68unreachable: ; preds = %catch69 unreachable70}71 72; Function Attrs: nounwind73declare void @_Z12bar_noexceptv()74 75declare void @_Z3barv()76 77declare i32 @__gxx_personality_v0(...)78 79declare ptr @__cxa_begin_catch(ptr)80 81declare void @__cxa_rethrow()82 83declare void @__cxa_end_catch()84 85; Function Attrs: noinline noreturn nounwind86define linkonce_odr hidden void @__clang_call_terminate(ptr) {87 %2 = call ptr @__cxa_begin_catch(ptr %0)88 call void @_ZSt9terminatev()89 unreachable90}91 92declare void @_ZSt9terminatev()93 94!llvm.dbg.cu = !{!0}95!llvm.module.flags = !{!3, !4, !5, !6}96!llvm.ident = !{!7}97 98; CHECK: ![[CALL1]] = !DILocation(line: 7, column: 5, scope: ![[SCOPE1:[0-9]+]])99; CHECK: ![[SCOPE1]] = distinct !DILexicalBlock(scope: !8, file: !1, line: 6, column: 7)100; CHECK: ![[CALL2]] = !DILocation(line: 7, column: 21, scope: ![[SCOPE2:[0-9]+]])101; CHECK: ![[SCOPE2]] = !DILexicalBlockFile(scope: ![[SCOPE1]], file: !1, discriminator: 2)102; CHECK: ![[INVOKE]] = !DILocation(line: 7, column: 37, scope: ![[SCOPE3:[0-9]+]])103; CHECK: ![[SCOPE3]] = !DILexicalBlockFile(scope: ![[SCOPE1]], file: !1, discriminator: 4)104 105!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: GNU)106!1 = !DIFile(filename: "invoke.cpp", directory: "examples")107!2 = !{}108!3 = !{i32 2, !"Dwarf Version", i32 4}109!4 = !{i32 2, !"Debug Info Version", i32 3}110!5 = !{i32 1, !"wchar_size", i32 4}111!6 = !{i32 7, !"PIC Level", i32 2}112!7 = !{!"clang version 8.0.0"}113!8 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 5, type: !9, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)114!9 = !DISubroutineType(types: !10)115!10 = !{null}116!11 = !DILocation(line: 7, column: 5, scope: !12)117!12 = distinct !DILexicalBlock(scope: !8, file: !1, line: 6, column: 7)118!13 = !DILocation(line: 7, column: 21, scope: !12)119!14 = !DILocation(line: 7, column: 37, scope: !12)120!15 = !DILocation(line: 8, column: 3, scope: !12)121!16 = !DILocation(line: 12, column: 1, scope: !12)122!17 = !DILocation(line: 10, column: 5, scope: !18)123!18 = distinct !DILexicalBlock(scope: !8, file: !1, line: 9, column: 15)124!19 = !DILocation(line: 12, column: 1, scope: !18)125!20 = !DILocation(line: 11, column: 3, scope: !18)126!21 = !DILocation(line: 12, column: 1, scope: !8)127