1; RUN: opt < %s -add-discriminators -S | FileCheck %s 2; 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 uwtable 8define void @_Z3foov() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !dbg !8 { 9entry: 10 %exn.slot = alloca i8* 11 %ehselector.slot = alloca i32 12 ; CHECK: call void @_Z12bar_noexceptv({{.*}} !dbg ![[CALL1:[0-9]+]] 13 call void @_Z12bar_noexceptv() #4, !dbg !11 14 ; CHECK: call void @_Z12bar_noexceptv({{.*}} !dbg ![[CALL2:[0-9]+]] 15 call void @_Z12bar_noexceptv() #4, !dbg !13 16 invoke void @_Z3barv() 17 ; CHECK: unwind label {{.*}} !dbg ![[INVOKE:[0-9]+]] 18 to label %invoke.cont unwind label %lpad, !dbg !14 19 20invoke.cont: ; preds = %entry 21 br label %try.cont, !dbg !15 22 23lpad: ; preds = %entry 24 %0 = landingpad { i8*, i32 } 25 catch i8* null, !dbg !16 26 %1 = extractvalue { i8*, i32 } %0, 0, !dbg !16 27 store i8* %1, i8** %exn.slot, align 8, !dbg !16 28 %2 = extractvalue { i8*, i32 } %0, 1, !dbg !16 29 store i32 %2, i32* %ehselector.slot, align 4, !dbg !16 30 br label %catch, !dbg !16 31 32catch: ; preds = %lpad 33 %exn = load i8*, i8** %exn.slot, align 8, !dbg !15 34 %3 = call i8* @__cxa_begin_catch(i8* %exn) #4, !dbg !15 35 invoke void @__cxa_rethrow() #5 36 to label %unreachable unwind label %lpad1, !dbg !17 37 38lpad1: ; preds = %catch 39 %4 = landingpad { i8*, i32 } 40 cleanup, !dbg !19 41 %5 = extractvalue { i8*, i32 } %4, 0, !dbg !19 42 store i8* %5, i8** %exn.slot, align 8, !dbg !19 43 %6 = extractvalue { i8*, i32 } %4, 1, !dbg !19 44 store i32 %6, i32* %ehselector.slot, align 4, !dbg !19 45 invoke void @__cxa_end_catch() 46 to label %invoke.cont2 unwind label %terminate.lpad, !dbg !20 47 48invoke.cont2: ; preds = %lpad1 49 br label %eh.resume, !dbg !20 50 51try.cont: ; preds = %invoke.cont 52 ret void, !dbg !21 53 54eh.resume: ; preds = %invoke.cont2 55 %exn3 = load i8*, i8** %exn.slot, align 8, !dbg !20 56 %sel = load i32, i32* %ehselector.slot, align 4, !dbg !20 57 %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn3, 0, !dbg !20 58 %lpad.val4 = insertvalue { i8*, i32 } %lpad.val, i32 %sel, 1, !dbg !20 59 resume { i8*, i32 } %lpad.val4, !dbg !20 60 61terminate.lpad: ; preds = %lpad1 62 %7 = landingpad { i8*, i32 } 63 catch i8* null, !dbg !20 64 %8 = extractvalue { i8*, i32 } %7, 0, !dbg !20 65 call void @__clang_call_terminate(i8* %8) #6, !dbg !20 66 unreachable, !dbg !20 67 68unreachable: ; preds = %catch 69 unreachable 70} 71 72; Function Attrs: nounwind 73declare void @_Z12bar_noexceptv() #1 74 75declare void @_Z3barv() #2 76 77declare i32 @__gxx_personality_v0(...) 78 79declare i8* @__cxa_begin_catch(i8*) 80 81declare void @__cxa_rethrow() 82 83declare void @__cxa_end_catch() 84 85; Function Attrs: noinline noreturn nounwind 86define linkonce_odr hidden void @__clang_call_terminate(i8*) #3 { 87 %2 = call i8* @__cxa_begin_catch(i8* %0) #4 88 call void @_ZSt9terminatev() #6 89 unreachable 90} 91 92declare void @_ZSt9terminatev() 93 94attributes #0 = { ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 95attributes #1 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 96attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 97attributes #3 = { noinline noreturn nounwind } 98attributes #4 = { nounwind } 99attributes #5 = { noreturn } 100attributes #6 = { noreturn nounwind } 101 102!llvm.dbg.cu = !{!0} 103!llvm.module.flags = !{!3, !4, !5, !6} 104!llvm.ident = !{!7} 105 106; CHECK: ![[CALL1]] = !DILocation(line: 7, column: 5, scope: ![[SCOPE1:[0-9]+]]) 107; CHECK: ![[SCOPE1]] = distinct !DILexicalBlock(scope: !8, file: !1, line: 6, column: 7) 108; CHECK: ![[CALL2]] = !DILocation(line: 7, column: 21, scope: ![[SCOPE2:[0-9]+]]) 109; CHECK: ![[SCOPE2]] = !DILexicalBlockFile(scope: ![[SCOPE1]], file: !1, discriminator: 2) 110; CHECK: ![[INVOKE]] = !DILocation(line: 7, column: 37, scope: ![[SCOPE3:[0-9]+]]) 111; CHECK: ![[SCOPE3]] = !DILexicalBlockFile(scope: ![[SCOPE1]], file: !1, discriminator: 4) 112 113!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) 114!1 = !DIFile(filename: "invoke.cpp", directory: "examples") 115!2 = !{} 116!3 = !{i32 2, !"Dwarf Version", i32 4} 117!4 = !{i32 2, !"Debug Info Version", i32 3} 118!5 = !{i32 1, !"wchar_size", i32 4} 119!6 = !{i32 7, !"PIC Level", i32 2} 120!7 = !{!"clang version 8.0.0"} 121!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) 122!9 = !DISubroutineType(types: !10) 123!10 = !{null} 124!11 = !DILocation(line: 7, column: 5, scope: !12) 125!12 = distinct !DILexicalBlock(scope: !8, file: !1, line: 6, column: 7) 126!13 = !DILocation(line: 7, column: 21, scope: !12) 127!14 = !DILocation(line: 7, column: 37, scope: !12) 128!15 = !DILocation(line: 8, column: 3, scope: !12) 129!16 = !DILocation(line: 12, column: 1, scope: !12) 130!17 = !DILocation(line: 10, column: 5, scope: !18) 131!18 = distinct !DILexicalBlock(scope: !8, file: !1, line: 9, column: 15) 132!19 = !DILocation(line: 12, column: 1, scope: !18) 133!20 = !DILocation(line: 11, column: 3, scope: !18) 134!21 = !DILocation(line: 12, column: 1, scope: !8) 135