1d966bf83SDerek Schuff; RUN: llc < %s -filetype=obj -o - | llvm-dwarfdump -
2d966bf83SDerek Schuff
3d966bf83SDerek Schuff; To regenerate this file, use approximately the following C code:
4d966bf83SDerek Schuff; int* globl;
5d966bf83SDerek Schuff; void baz(int arg) {
6d966bf83SDerek Schuff;   int locl;
7d966bf83SDerek Schuff;   globl = &locl;
8d966bf83SDerek Schuff; }
9d966bf83SDerek Schuff
10d966bf83SDerek Schuff; CHECK: DW_TAG_subprogram
11d966bf83SDerek Schuff; CHECK-NEXT:                DW_AT_low_pc
12d966bf83SDerek Schuff; CHECK-NEXT:                DW_AT_high_pc
13d966bf83SDerek Schuff;; Check that we fall back to the default frame base (the global)
1448139ebcSWouter van Oortmerssen; CHECK-NEXT:                DW_AT_frame_base	(DW_OP_WASM_location_int 0x3 0x0, DW_OP_stack_value)
15d966bf83SDerek Schuff
16d966bf83SDerek Schuff; TODO: Find a more-reduced test case for The fix in WebAssemblyRegColoring
17d966bf83SDerek Schuff
18d966bf83SDerek Schuff; ModuleID = 'debugtest-opt.c'
19d966bf83SDerek Schuffsource_filename = "debugtest-opt.c"
20d966bf83SDerek Schufftarget triple = "wasm32"
21d966bf83SDerek Schuff
22d966bf83SDerek Schuff@globl = hidden local_unnamed_addr global i32* null, align 4, !dbg !0
23d966bf83SDerek Schuff
24d966bf83SDerek Schuff; Function Attrs: nounwind writeonly
25d966bf83SDerek Schuffdefine hidden void @baz(i32 %arg) local_unnamed_addr #0 !dbg !12 {
26d966bf83SDerek Schuffentry:
27d966bf83SDerek Schuff  %locl = alloca i32, align 4
28d966bf83SDerek Schuff  call void @llvm.dbg.value(metadata i32 %arg, metadata !16, metadata !DIExpression()), !dbg !18
29d966bf83SDerek Schuff  %0 = bitcast i32* %locl to i8*, !dbg !19
30d966bf83SDerek Schuff  store i32* %locl, i32** @globl, align 4, !dbg !20, !tbaa !21
31d966bf83SDerek Schuff  ret void, !dbg !25
32d966bf83SDerek Schuff}
33d966bf83SDerek Schuff
34d966bf83SDerek Schuff; Function Attrs: nounwind readnone speculatable willreturn
35d966bf83SDerek Schuffdeclare void @llvm.dbg.value(metadata, metadata, metadata) #2
36d966bf83SDerek Schuff
37*4ab3041aSserge-sans-pailleattributes #0 = { nounwind writeonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "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"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
38d966bf83SDerek Schuffattributes #1 = { argmemonly nounwind willreturn }
39d966bf83SDerek Schuffattributes #2 = { nounwind readnone speculatable willreturn }
40d966bf83SDerek Schuffattributes #3 = { nounwind }
41d966bf83SDerek Schuff
42d966bf83SDerek Schuff!llvm.dbg.cu = !{!2}
43d966bf83SDerek Schuff!llvm.module.flags = !{!8, !9, !10}
44d966bf83SDerek Schuff!llvm.ident = !{!11}
45d966bf83SDerek Schuff
46d966bf83SDerek Schuff!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
47d966bf83SDerek Schuff!1 = distinct !DIGlobalVariable(name: "globl", scope: !2, file: !3, line: 2, type: !6, isLocal: false, isDefinition: true)
48d966bf83SDerek Schuff!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git ee80f8bef31e0f98c9a0e1d79dc5f1ff51ed9e3a)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
49d966bf83SDerek Schuff!3 = !DIFile(filename: "debugtest-opt.c", directory: "/s/llvm-upstream")
50d966bf83SDerek Schuff!4 = !{}
51d966bf83SDerek Schuff!5 = !{!0}
52d966bf83SDerek Schuff!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32)
53d966bf83SDerek Schuff!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
54d966bf83SDerek Schuff!8 = !{i32 7, !"Dwarf Version", i32 4}
55d966bf83SDerek Schuff!9 = !{i32 2, !"Debug Info Version", i32 3}
56d966bf83SDerek Schuff!10 = !{i32 1, !"wchar_size", i32 4}
57d966bf83SDerek Schuff!11 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git ee80f8bef31e0f98c9a0e1d79dc5f1ff51ed9e3a)"}
58d966bf83SDerek Schuff!12 = distinct !DISubprogram(name: "baz", scope: !3, file: !3, line: 14, type: !13, scopeLine: 14, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !15)
59d966bf83SDerek Schuff!13 = !DISubroutineType(types: !14)
60d966bf83SDerek Schuff!14 = !{null, !7}
61d966bf83SDerek Schuff!15 = !{!16, !17}
62d966bf83SDerek Schuff!16 = !DILocalVariable(name: "arg", arg: 1, scope: !12, file: !3, line: 14, type: !7)
63d966bf83SDerek Schuff!17 = !DILocalVariable(name: "locl", scope: !12, file: !3, line: 15, type: !7)
64d966bf83SDerek Schuff!18 = !DILocation(line: 0, scope: !12)
65d966bf83SDerek Schuff!19 = !DILocation(line: 15, column: 3, scope: !12)
66d966bf83SDerek Schuff!20 = !DILocation(line: 16, column: 9, scope: !12)
67d966bf83SDerek Schuff!21 = !{!22, !22, i64 0}
68d966bf83SDerek Schuff!22 = !{!"any pointer", !23, i64 0}
69d966bf83SDerek Schuff!23 = !{!"omnipotent char", !24, i64 0}
70d966bf83SDerek Schuff!24 = !{!"Simple C/C++ TBAA"}
71d966bf83SDerek Schuff!25 = !DILocation(line: 17, column: 1, scope: !12)
72