184 lines · plain
1; RUN: llvm-dis %s.bc -o - | FileCheck %s2; ModuleID = 'DILocation-implicit-code.cpp'3source_filename = "DILocation-implicit-code.cpp"4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"5target triple = "x86_64-unknown-linux-gnu"6 7%struct.A = type { i8 }8 9$_ZN1AC2Ev = comdat any10 11$_ZN1A3fooEi = comdat any12 13@_ZTIi = external dso_local constant i8*14 15; Function Attrs: noinline optnone uwtable16define dso_local void @_Z5test1v() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !dbg !7 {17entry:18 %retval = alloca %struct.A, align 119 %a = alloca %struct.A, align 120 %exn.slot = alloca i8*21 %ehselector.slot = alloca i3222 %undef.agg.tmp = alloca %struct.A, align 123 %e = alloca i32, align 424 %undef.agg.tmp3 = alloca %struct.A, align 125 call void @_ZN1AC2Ev(%struct.A* %a), !dbg !926 invoke void @_ZN1A3fooEi(%struct.A* %a, i32 0)27 to label %invoke.cont unwind label %lpad, !dbg !1028 29invoke.cont: ; preds = %entry30 br label %return, !dbg !1131 32lpad: ; preds = %entry33 %0 = landingpad { i8*, i32 }34 catch i8* bitcast (i8** @_ZTIi to i8*), !dbg !1235 %1 = extractvalue { i8*, i32 } %0, 0, !dbg !1236 store i8* %1, i8** %exn.slot, align 8, !dbg !1237 %2 = extractvalue { i8*, i32 } %0, 1, !dbg !1238 store i32 %2, i32* %ehselector.slot, align 4, !dbg !1239 br label %catch.dispatch, !dbg !1240 41catch.dispatch: ; preds = %lpad42 %sel = load i32, i32* %ehselector.slot, align 4, !dbg !1343 %3 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)), !dbg !1344 %matches = icmp eq i32 %sel, %3, !dbg !1345 br i1 %matches, label %catch, label %eh.resume, !dbg !1346 47catch: ; preds = %catch.dispatch48 %exn = load i8*, i8** %exn.slot, align 8, !dbg !1349 %4 = call i8* @__cxa_begin_catch(i8* %exn), !dbg !1350 %5 = bitcast i8* %4 to i32*, !dbg !1351 %6 = load i32, i32* %5, align 4, !dbg !1352 store i32 %6, i32* %e, align 4, !dbg !1353 %7 = load i32, i32* %e, align 4, !dbg !1454 invoke void @_ZN1A3fooEi(%struct.A* %a, i32 %7)55 to label %invoke.cont2 unwind label %lpad1, !dbg !1556 57invoke.cont2: ; preds = %catch58 call void @__cxa_end_catch(), !dbg !1659 br label %return60 61lpad1: ; preds = %catch62 %8 = landingpad { i8*, i32 }63 cleanup, !dbg !1264 %9 = extractvalue { i8*, i32 } %8, 0, !dbg !1265 store i8* %9, i8** %exn.slot, align 8, !dbg !1266 %10 = extractvalue { i8*, i32 } %8, 1, !dbg !1267 store i32 %10, i32* %ehselector.slot, align 4, !dbg !1268 call void @__cxa_end_catch(), !dbg !1669 br label %eh.resume, !dbg !1670 71try.cont: ; No predecessors!72 call void @llvm.trap(), !dbg !1673 unreachable, !dbg !1674 75return: ; preds = %invoke.cont2, %invoke.cont76 ret void, !dbg !1277 78eh.resume: ; preds = %lpad1, %catch.dispatch79 %exn4 = load i8*, i8** %exn.slot, align 8, !dbg !1380 %sel5 = load i32, i32* %ehselector.slot, align 4, !dbg !1381 %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn4, 0, !dbg !1382 %lpad.val6 = insertvalue { i8*, i32 } %lpad.val, i32 %sel5, 1, !dbg !1383 resume { i8*, i32 } %lpad.val6, !dbg !1384}85 86; Function Attrs: noinline nounwind optnone uwtable87define linkonce_odr dso_local void @_ZN1AC2Ev(%struct.A* %this) unnamed_addr comdat align 2 !dbg !17 {88entry:89 %this.addr = alloca %struct.A*, align 890 store %struct.A* %this, %struct.A** %this.addr, align 891 %this1 = load %struct.A*, %struct.A** %this.addr, align 892 ret void, !dbg !1893}94 95; Function Attrs: noinline optnone uwtable96define linkonce_odr dso_local void @_ZN1A3fooEi(%struct.A* %this, i32 %i) comdat align 2 !dbg !19 {97entry:98 %retval = alloca %struct.A, align 199 %this.addr = alloca %struct.A*, align 8100 %i.addr = alloca i32, align 4101 store %struct.A* %this, %struct.A** %this.addr, align 8102 store i32 %i, i32* %i.addr, align 4103 %this1 = load %struct.A*, %struct.A** %this.addr, align 8104 %0 = load i32, i32* %i.addr, align 4, !dbg !20105 %cmp = icmp eq i32 %0, 0, !dbg !21106 br i1 %cmp, label %if.then, label %if.end, !dbg !20107 108if.then: ; preds = %entry109 %exception = call i8* @__cxa_allocate_exception(i64 4), !dbg !22110 %1 = bitcast i8* %exception to i32*, !dbg !22111 store i32 1, i32* %1, align 16, !dbg !22112 call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null), !dbg !22113 unreachable, !dbg !22114 115if.end: ; preds = %entry116 ret void, !dbg !23117}118 119declare dso_local i32 @__gxx_personality_v0(...)120 121; Function Attrs: nounwind readnone122declare i32 @llvm.eh.typeid.for(i8*)123 124declare dso_local i8* @__cxa_begin_catch(i8*)125 126declare dso_local void @__cxa_end_catch()127 128; Function Attrs: noreturn nounwind129declare void @llvm.trap()130 131; Function Attrs: noinline optnone uwtable132define dso_local void @_Z5test2v() !dbg !24 {133entry:134 %a = alloca %struct.A, align 1135 %b = alloca %struct.A, align 1136 %undef.agg.tmp = alloca %struct.A, align 1137 call void @_ZN1AC2Ev(%struct.A* %a), !dbg !25138 call void @_ZN1A3fooEi(%struct.A* %a, i32 1), !dbg !26139 ret void, !dbg !27140}141 142declare dso_local i8* @__cxa_allocate_exception(i64)143 144declare dso_local void @__cxa_throw(i8*, i8*, i8*)145 146!llvm.dbg.cu = !{!0}147!llvm.module.flags = !{!3, !4, !5}148!llvm.ident = !{!6}149 150; CHECK: !DILocation(line: 20, column: 1, scope: !{{[0-9]+}}, isImplicitCode: true)151; CHECK: !DILocation(line: 17, column: 5, scope: !{{[0-9]+}}, isImplicitCode: true)152; CHECK: !DILocation(line: 19, column: 5, scope: !{{[0-9]+}}, isImplicitCode: true)153; CHECK: !DILocation(line: 3, column: 10, scope: !{{[0-9]+}}, isImplicitCode: true)154; CHECK: !DILocation(line: 25, column: 1, scope: !{{[0-9]+}}, isImplicitCode: true)155 156!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0 (trunk 342445)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, nameTableKind: None)157!1 = !DIFile(filename: "DILocation-implicit-code.cpp", directory: "/tmp")158!2 = !{}159!3 = !{i32 2, !"Dwarf Version", i32 4}160!4 = !{i32 2, !"Debug Info Version", i32 3}161!5 = !{i32 1, !"wchar_size", i32 4}162!6 = !{!"clang version 8.0.0 (trunk 342445)"}163!7 = distinct !DISubprogram(name: "test1", scope: !1, file: !1, line: 13, type: !8, isLocal: false, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)164!8 = !DISubroutineType(types: !2)165!9 = !DILocation(line: 14, column: 7, scope: !7)166!10 = !DILocation(line: 16, column: 18, scope: !7)167!11 = !DILocation(line: 16, column: 9, scope: !7)168!12 = !DILocation(line: 20, column: 1, scope: !7, isImplicitCode: true)169!13 = !DILocation(line: 17, column: 5, scope: !7, isImplicitCode: true)170!14 = !DILocation(line: 18, column: 22, scope: !7)171!15 = !DILocation(line: 18, column: 18, scope: !7)172!16 = !DILocation(line: 19, column: 5, scope: !7, isImplicitCode: true)173!17 = distinct !DISubprogram(name: "A", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)174!18 = !DILocation(line: 3, column: 10, scope: !17, isImplicitCode: true)175!19 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)176!20 = !DILocation(line: 5, column: 13, scope: !19)177!21 = !DILocation(line: 5, column: 15, scope: !19)178!22 = !DILocation(line: 6, column: 13, scope: !19)179!23 = !DILocation(line: 9, column: 9, scope: !19)180!24 = distinct !DISubprogram(name: "test2", scope: !1, file: !1, line: 22, type: !8, isLocal: false, isDefinition: true, scopeLine: 22, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)181!25 = !DILocation(line: 23, column: 7, scope: !24)182!26 = !DILocation(line: 24, column: 13, scope: !24)183!27 = !DILocation(line: 25, column: 1, scope: !24, isImplicitCode: true)184