xref: /llvm-project/llvm/test/DebugInfo/WebAssembly/debugtest-opt.ll (revision 5a288fa32e0c91b211e39f3e370255916902f898)
1; RUN: llc < %s -filetype=obj -o - | llvm-dwarfdump -
2
3; To regenerate this file, use approximately the following C code:
4; int* globl;
5; void baz(int arg) {
6;   int locl;
7;   globl = &locl;
8; }
9
10; CHECK: DW_TAG_subprogram
11; CHECK-NEXT:                DW_AT_low_pc
12; CHECK-NEXT:                DW_AT_high_pc
13;; Check that we fall back to the default frame base (the global)
14; CHECK-NEXT:                DW_AT_frame_base	(DW_OP_WASM_location_int 0x3 0x0, DW_OP_stack_value)
15
16; TODO: Find a more-reduced test case for The fix in WebAssemblyRegColoring
17
18; ModuleID = 'debugtest-opt.c'
19source_filename = "debugtest-opt.c"
20target triple = "wasm32"
21
22@globl = hidden local_unnamed_addr global ptr null, align 4, !dbg !0
23
24; Function Attrs: nounwind writeonly
25define hidden void @baz(i32 %arg) local_unnamed_addr #0 !dbg !12 {
26entry:
27  %locl = alloca i32, align 4
28  call void @llvm.dbg.value(metadata i32 %arg, metadata !16, metadata !DIExpression()), !dbg !18
29  store ptr %locl, ptr @globl, align 4, !dbg !20, !tbaa !21
30  ret void, !dbg !25
31}
32
33; Function Attrs: nounwind readnone speculatable willreturn
34declare void @llvm.dbg.value(metadata, metadata, metadata) #2
35
36attributes #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" }
37attributes #1 = { argmemonly nounwind willreturn }
38attributes #2 = { nounwind readnone speculatable willreturn }
39attributes #3 = { nounwind }
40
41!llvm.dbg.cu = !{!2}
42!llvm.module.flags = !{!8, !9, !10}
43!llvm.ident = !{!11}
44
45!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
46!1 = distinct !DIGlobalVariable(name: "globl", scope: !2, file: !3, line: 2, type: !6, isLocal: false, isDefinition: true)
47!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)
48!3 = !DIFile(filename: "debugtest-opt.c", directory: "/s/llvm-upstream")
49!4 = !{}
50!5 = !{!0}
51!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32)
52!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
53!8 = !{i32 7, !"Dwarf Version", i32 4}
54!9 = !{i32 2, !"Debug Info Version", i32 3}
55!10 = !{i32 1, !"wchar_size", i32 4}
56!11 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git ee80f8bef31e0f98c9a0e1d79dc5f1ff51ed9e3a)"}
57!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)
58!13 = !DISubroutineType(types: !14)
59!14 = !{null, !7}
60!15 = !{!16, !17}
61!16 = !DILocalVariable(name: "arg", arg: 1, scope: !12, file: !3, line: 14, type: !7)
62!17 = !DILocalVariable(name: "locl", scope: !12, file: !3, line: 15, type: !7)
63!18 = !DILocation(line: 0, scope: !12)
64!19 = !DILocation(line: 15, column: 3, scope: !12)
65!20 = !DILocation(line: 16, column: 9, scope: !12)
66!21 = !{!22, !22, i64 0}
67!22 = !{!"any pointer", !23, i64 0}
68!23 = !{!"omnipotent char", !24, i64 0}
69!24 = !{!"Simple C/C++ TBAA"}
70!25 = !DILocation(line: 17, column: 1, scope: !12)
71