1; RUN: llc -mtriple=x86_64 -filetype=obj < %s \ 2; RUN: | llvm-dwarfdump -debug-info -debug-loclists - | FileCheck %s 3; RUN: llc -mtriple=x86_64 -split-dwarf-file=foo.dwo -filetype=obj -dwarf-op-convert=Enable < %s \ 4; RUN: | llvm-dwarfdump -debug-info -debug-loclists - | FileCheck --check-prefix=SPLIT --check-prefix=CHECK %s 5; RUN: llc -mtriple=x86_64 -split-dwarf-file=foo.dwo -filetype=asm -dwarf-op-convert=Enable < %s \ 6; RUN: | FileCheck --check-prefix=ASM %s 7 8; A bit of a brittle test - this is testing the specific DWO_id. The 9; alternative would be to test two files with different DW_OP_convert values & 10; ensuring the DWO IDs differ when the DW_OP_convert parameter differs. 11 12; So if this test ends up being a brittle pain to maintain, updating the DWO ID 13; often - add another IR file with a different DW_OP_convert that's otherwise 14; identical and demonstrate that they have different DWO IDs. 15 16; SPLIT: 0x00000000: Compile Unit: {{.*}} DWO_id = 0x6f8c6730fe6cbff0 17 18; Regression testing a fairly quirky bug where instead of hashing (see above), 19; extra bytes would be emitted into the output assembly in no 20; particular/intentional section - so let's check they don't show up at all: 21; ASM-NOT: .asciz "\200\200\200" 22; ASM: .byte 10 # Loc expr size 23; ASM-NEXT: .byte 17 # DW_OP_consts 24; ASM-NEXT: .byte 7 # 7 25; ASM-NEXT: .byte 48 # DW_OP_lit0 26; ASM-NEXT: .byte 34 # DW_OP_plus 27; ASM-NEXT: .byte 168 # DW_OP_convert 28; ASM-NEXT: .asciz "\232\200\200" # 29; ASM-NEXT: .byte 159 # DW_OP_stack_value 30; ASM-NEXT: .byte 0 # DW_LLE_end_of_list 31; ASM-NOT: .asciz "\200\200\200" 32 33; CHECK: 0x{{0*}}[[TYPE:.*]]: DW_TAG_base_type 34; CHECK-NEXT: DW_AT_name ("DW_ATE_unsigned_32") 35 36; CHECK: DW_LLE_offset_pair ({{.*}}): DW_OP_consts +7, DW_OP_lit0, DW_OP_plus, DW_OP_convert 0x[[TYPE]], DW_OP_stack_value 37 38; Function Attrs: uwtable 39define dso_local void @_Z2f2v() local_unnamed_addr #0 !dbg !11 { 40entry: 41 tail call void @_Z2f1v(), !dbg !15 42;; This test depends on "convert" surviving all the way to the final object. 43;; So, insert something before DW_OP_LLVM_convert that the expression folder 44;; will not attempt to eliminate. At the moment, only "convert" ops are folded. 45;; If you have to change the expression, the expected DWO_id also changes. 46 call void @llvm.dbg.value(metadata i32 7, metadata !13, metadata !DIExpression(DW_OP_lit0, DW_OP_plus, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_stack_value)), !dbg !16 47 tail call void @_Z2f1v(), !dbg !17 48 ret void, !dbg !18 49} 50 51declare !dbg !4 dso_local void @_Z2f1v() local_unnamed_addr #1 52 53; Function Attrs: nounwind readnone speculatable willreturn 54declare void @llvm.dbg.value(metadata, metadata, metadata) #2 55 56attributes #0 = { uwtable "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"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 57attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 58attributes #2 = { nounwind readnone speculatable willreturn } 59 60!llvm.dbg.cu = !{!0} 61!llvm.module.flags = !{!7, !8, !9} 62!llvm.ident = !{!10} 63 64!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0 (git@github.com:llvm/llvm-project.git edc3f4f02e54c2ae1067f60f6a0ed6caf5b92ef6)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) 65!1 = !DIFile(filename: "loc.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch") 66!2 = !{} 67!4 = !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 68!5 = !DISubroutineType(types: !6) 69!6 = !{null} 70!7 = !{i32 7, !"Dwarf Version", i32 5} 71!8 = !{i32 2, !"Debug Info Version", i32 3} 72!9 = !{i32 1, !"wchar_size", i32 4} 73!10 = !{!"clang version 11.0.0 (git@github.com:llvm/llvm-project.git edc3f4f02e54c2ae1067f60f6a0ed6caf5b92ef6)"} 74!11 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !5, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12) 75!12 = !{!13} 76!13 = !DILocalVariable(name: "x", scope: !11, file: !1, line: 3, type: !14) 77!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 78!15 = !DILocation(line: 4, column: 3, scope: !11) 79!16 = !DILocation(line: 0, scope: !11) 80!17 = !DILocation(line: 6, column: 3, scope: !11) 81!18 = !DILocation(line: 7, column: 1, scope: !11) 82