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