brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · 55cae15 Raw
93 lines · plain
1; RUN: llc -debug-entry-values -filetype=asm -o - %s | FileCheck %s2; RUN: llc -force-instr-ref-livedebugvalues=1 -debug-entry-values -filetype=asm -o - %s | FileCheck %s3 4; Verify that the size operands of the DW_OP_GNU_entry_value operations are5; correct for the multi-byte DW_OP_regx expressions.6 7; Based on the following C reproducer:8;9; extern void clobber();10; double global;11; int f(double a, double b) {12;   global = a + b;13;   clobber();14;   return 1;15; }16 17; This test checks the assembly output rather than the output from18; llvm-dwarfdump, as the latter printed the DW_OP_regx D0 correctly, even19; though the entry value's size operand did not fully cover that:20 21; DW_OP_GNU_entry_value(DW_OP_regx D0), DW_OP_stack_value22;23; whereas readelf interpreted it as an DW_OP_GNU_entry_value covering one byte,24; resulting in garbage data:25;26; DW_OP_GNU_entry_value: (DW_OP_regx: 0 (r0)); DW_OP_breg16 (r16): 2; DW_OP_stack_value27 28; CHECK:      .byte   243       @ DW_OP_GNU_entry_value29; CHECK-NEXT: .byte   3         @ 330; CHECK-NEXT: .byte   144       @ DW_OP_regx31; CHECK-NEXT: .byte   128       @ 25632; CHECK-NEXT: .byte   2         @33; CHECK-NEXT: .byte   159       @ DW_OP_stack_value34 35; CHECK:      .byte   243       @ DW_OP_GNU_entry_value36; CHECK-NEXT: .byte   3         @ 337; CHECK-NEXT: .byte   144       @ DW_OP_regx38; CHECK-NEXT: .byte   129       @ 25739; CHECK-NEXT: .byte   2         @40; CHECK-NEXT: .byte   159       @ DW_OP_stack_value41 42target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"43target triple = "armv7-unknown-unknown"44 45@global = common global double 0.000000e+00, align 8, !dbg !046 47; Function Attrs: nounwind48define arm_aapcs_vfpcc i32 @f(double %a, double %b) #0 !dbg !12 {49entry:50  call void @llvm.dbg.value(metadata double %a, metadata !17, metadata !DIExpression()), !dbg !1951  call void @llvm.dbg.value(metadata double %b, metadata !18, metadata !DIExpression()), !dbg !1952  %add = fadd double %a, %b, !dbg !2053  store double %add, ptr @global, align 8, !dbg !2054  tail call arm_aapcs_vfpcc void @clobber(), !dbg !2155  ret i32 1, !dbg !2256}57 58declare arm_aapcs_vfpcc void @clobber()59 60; Function Attrs: nounwind readnone speculatable willreturn61declare void @llvm.dbg.value(metadata, metadata, metadata) #162 63attributes #0 = { nounwind }64attributes #1 = { nounwind readnone speculatable willreturn }65 66!llvm.dbg.cu = !{!2}67!llvm.module.flags = !{!7, !8, !9, !10}68!llvm.ident = !{!11}69 70!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())71!1 = distinct !DIGlobalVariable(name: "global", scope: !2, file: !3, line: 4, type: !6, isLocal: false, isDefinition: true)72!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)73!3 = !DIFile(filename: "entry-value-multi-byte-expr.c", directory: "/")74!4 = !{}75!5 = !{!0}76!6 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)77!7 = !{i32 2, !"Dwarf Version", i32 4}78!8 = !{i32 2, !"Debug Info Version", i32 3}79!9 = !{i32 1, !"wchar_size", i32 4}80!10 = !{i32 1, !"min_enum_size", i32 4}81!11 = !{!"clang version 10.0.0"}82!12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 6, type: !13, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !16)83!13 = !DISubroutineType(types: !14)84!14 = !{!15, !6, !6}85!15 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)86!16 = !{!17, !18}87!17 = !DILocalVariable(name: "a", arg: 1, scope: !12, file: !3, line: 6, type: !6)88!18 = !DILocalVariable(name: "b", arg: 2, scope: !12, file: !3, line: 6, type: !6)89!19 = !DILocation(line: 0, scope: !12)90!20 = !DILocation(line: 7, scope: !12)91!21 = !DILocation(line: 8, scope: !12)92!22 = !DILocation(line: 9, scope: !12)93