1; RUN: llc < %s | FileCheck %s 2 3; Verify that we get *two* .debug$S sections, the main one describing bar and 4; main, and one for f and fin$f, which is comdat with f. 5 6; Start in the main symbol section describing bar and main. 7 8; CHECK: .section .debug$S,"dr"{{$}} 9; CHECK: .long 4 # Debug section magic 10; CHECK: # Symbol subsection for bar 11; CHECK-NOT: Debug section magic 12; CHECK: # Symbol subsection for main 13 14; Emit symbol info for f and its associated code in a separate associated 15; section. 16 17; CHECK: .section .debug$S,"dr",associative,f{{$}} 18; CHECK: .long 4 # Debug section magic 19; CHECK: # Symbol subsection for f 20; CHECK-NOT: Debug section magic 21; CHECK: # Symbol subsection for ?fin$0@0@f@@ 22 23; Switch back to the main section for the shared file checksum table and string 24; table. 25 26; CHECK: .section .debug$S,"dr"{{$}} 27; CHECK-NOT: Debug section magic 28; CHECK: .cv_filechecksums 29; CHECK: .cv_stringtable 30; CHECK-NOT: .section .debug$S, 31 32; Generated with this C++ source: 33; void foo(); 34; void bar(); 35; extern volatile int x; 36; inline void __declspec(noinline) f(bool c) { 37; x++; 38; if (c) { 39; __try { 40; foo(); 41; } __finally { 42; x++; 43; } 44; } else 45; bar(); 46; x++; 47; } 48; void bar() { 49; x++; 50; } 51; int main() { 52; f(true); 53; } 54 55; ModuleID = 't.cpp' 56source_filename = "t.cpp" 57target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 58target triple = "x86_64-pc-windows-msvc19.0.23918" 59 60$f = comdat any 61 62@x = external global i32, align 4 63 64; Function Attrs: norecurse nounwind uwtable 65define void @bar() #0 !dbg !7 { 66entry: 67 %0 = load volatile i32, i32* @x, align 4, !dbg !10, !tbaa !11 68 %inc = add nsw i32 %0, 1, !dbg !10 69 store volatile i32 %inc, i32* @x, align 4, !dbg !10, !tbaa !11 70 ret void, !dbg !15 71} 72 73; Function Attrs: nounwind uwtable 74define i32 @main() #1 !dbg !16 { 75entry: 76 tail call void @f(i32 1), !dbg !20 77 ret i32 0, !dbg !21 78} 79 80; Function Attrs: inlinehint noinline nounwind uwtable 81define linkonce_odr void @f(i32 %c) #2 comdat personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) !dbg !22 { 82entry: 83 tail call void @llvm.dbg.value(metadata i32 %c, metadata !26, metadata !27), !dbg !28 84 %0 = load volatile i32, i32* @x, align 4, !dbg !29, !tbaa !11 85 %inc = add nsw i32 %0, 1, !dbg !29 86 store volatile i32 %inc, i32* @x, align 4, !dbg !29, !tbaa !11 87 %tobool = icmp eq i32 %c, 0, !dbg !30 88 br i1 %tobool, label %if.else, label %if.then, !dbg !32 89 90if.then: ; preds = %entry 91 invoke void bitcast (void (...)* @foo to void ()*)() #6 92 to label %invoke.cont unwind label %ehcleanup, !dbg !33 93 94invoke.cont: ; preds = %if.then 95 tail call fastcc void @"\01?fin$0@0@f@@"() #7, !dbg !36 96 br label %if.end, !dbg !37 97 98ehcleanup: ; preds = %if.then 99 %1 = cleanuppad within none [], !dbg !36 100 tail call fastcc void @"\01?fin$0@0@f@@"() #7 [ "funclet"(token %1) ], !dbg !36 101 cleanupret from %1 unwind to caller, !dbg !36 102 103if.else: ; preds = %entry 104 tail call void @bar(), !dbg !38 105 br label %if.end 106 107if.end: ; preds = %if.else, %invoke.cont 108 %2 = load volatile i32, i32* @x, align 4, !dbg !39, !tbaa !11 109 %inc1 = add nsw i32 %2, 1, !dbg !39 110 store volatile i32 %inc1, i32* @x, align 4, !dbg !39, !tbaa !11 111 ret void, !dbg !40 112} 113 114; Function Attrs: nounwind 115define internal fastcc void @"\01?fin$0@0@f@@"() unnamed_addr #3 comdat($f) !dbg !41 { 116entry: 117 tail call void @llvm.dbg.value(metadata i8* null, metadata !44, metadata !27), !dbg !48 118 tail call void @llvm.dbg.value(metadata i8 0, metadata !46, metadata !27), !dbg !48 119 %0 = load volatile i32, i32* @x, align 4, !dbg !49, !tbaa !11 120 %inc = add nsw i32 %0, 1, !dbg !49 121 store volatile i32 %inc, i32* @x, align 4, !dbg !49, !tbaa !11 122 ret void, !dbg !51 123} 124 125declare void @foo(...) #4 126 127declare i32 @__C_specific_handler(...) 128 129; Function Attrs: nounwind readnone 130declare void @llvm.dbg.value(metadata, metadata, metadata) #5 131 132attributes #0 = { norecurse nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 133attributes #1 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 134attributes #2 = { inlinehint noinline nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 135attributes #3 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 136attributes #4 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 137attributes #5 = { nounwind readnone } 138attributes #6 = { noinline } 139attributes #7 = { nounwind } 140 141!llvm.dbg.cu = !{!0} 142!llvm.module.flags = !{!3, !4, !5} 143!llvm.ident = !{!6} 144 145!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 146!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild") 147!2 = !{} 148!3 = !{i32 2, !"CodeView", i32 1} 149!4 = !{i32 2, !"Debug Info Version", i32 3} 150!5 = !{i32 1, !"PIC Level", i32 2} 151!6 = !{!"clang version 3.9.0 "} 152!7 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 19, type: !8, isLocal: false, isDefinition: true, scopeLine: 19, isOptimized: true, unit: !0, retainedNodes: !2) 153!8 = !DISubroutineType(types: !9) 154!9 = !{null} 155!10 = !DILocation(line: 20, column: 4, scope: !7) 156!11 = !{!12, !12, i64 0} 157!12 = !{!"int", !13, i64 0} 158!13 = !{!"omnipotent char", !14, i64 0} 159!14 = !{!"Simple C/C++ TBAA"} 160!15 = !DILocation(line: 21, column: 1, scope: !7) 161!16 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 22, type: !17, isLocal: false, isDefinition: true, scopeLine: 22, isOptimized: true, unit: !0, retainedNodes: !2) 162!17 = !DISubroutineType(types: !18) 163!18 = !{!19} 164!19 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 165!20 = !DILocation(line: 23, column: 3, scope: !16) 166!21 = !DILocation(line: 24, column: 1, scope: !16) 167!22 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 5, type: !23, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !25) 168!23 = !DISubroutineType(types: !24) 169!24 = !{null, !19} 170!25 = !{!26} 171!26 = !DILocalVariable(name: "c", arg: 1, scope: !22, file: !1, line: 5, type: !19) 172!27 = !DIExpression() 173!28 = !DILocation(line: 5, column: 40, scope: !22) 174!29 = !DILocation(line: 6, column: 4, scope: !22) 175!30 = !DILocation(line: 7, column: 7, scope: !31) 176!31 = distinct !DILexicalBlock(scope: !22, file: !1, line: 7, column: 7) 177!32 = !DILocation(line: 7, column: 7, scope: !22) 178!33 = !DILocation(line: 9, column: 7, scope: !34) 179!34 = distinct !DILexicalBlock(scope: !35, file: !1, line: 8, column: 11) 180!35 = distinct !DILexicalBlock(scope: !31, file: !1, line: 7, column: 10) 181!36 = !DILocation(line: 10, column: 5, scope: !34) 182!37 = !DILocation(line: 13, column: 3, scope: !35) 183!38 = !DILocation(line: 14, column: 5, scope: !31) 184!39 = !DILocation(line: 15, column: 4, scope: !22) 185!40 = !DILocation(line: 16, column: 1, scope: !22) 186!41 = distinct !DISubprogram(linkageName: "\01?fin$0@0@f@@", scope: !1, file: !1, line: 10, type: !42, isLocal: true, isDefinition: true, scopeLine: 10, flags: DIFlagArtificial, isOptimized: true, unit: !0, retainedNodes: !43) 187!42 = !DISubroutineType(types: !2) 188!43 = !{!44, !46} 189!44 = !DILocalVariable(name: "frame_pointer", arg: 2, scope: !41, type: !45, flags: DIFlagArtificial) 190!45 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64, align: 64) 191!46 = !DILocalVariable(name: "abnormal_termination", arg: 1, scope: !41, type: !47, flags: DIFlagArtificial | DIFlagObjectPointer) 192!47 = !DIBasicType(name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char) 193!48 = !DILocation(line: 0, scope: !41) 194!49 = !DILocation(line: 11, column: 8, scope: !50) 195!50 = distinct !DILexicalBlock(scope: !41, file: !1, line: 10, column: 17) 196!51 = !DILocation(line: 12, column: 5, scope: !41) 197