brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · 2d7a6a3 Raw
110 lines · plain
1; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump -debug-info - | FileCheck %s2;3; Checks that we're omitting the first range, as it is empty, and that we're4; emitting one that spans the rest of the function. In this case, the first5; range, which we omit, describes 8 bytes of the variable using DW_OP_litX,6; whereas the second one only describes 4 bytes, so clobbering the whole 8 byte7; fragment with the 4 bytes fragment isn't necessarily best thing to do here,8; but it is what is currently being emitted. Any change here needs to be9; intentional, so the test is very specific.10;11; The variable is given a single location instead of a location list entry12; because the function validThroughout has a special code path for single13; locations with a constant value that start in the prologue.14;15; CHECK:      DW_TAG_inlined_subroutine16; CHECK:        DW_TAG_variable17; CHECK-NEXT:     DW_AT_location (DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4)18; CHECK-NEXT:     DW_AT_abstract_origin19 20; Created from the following test case (PR26163) with21; clang -cc1 -triple armv4t--freebsd11.0-gnueabi -emit-obj -debug-info-kind=standalone -O2 -x c test.c22;23; typedef	unsigned int	size_t;24; struct timeval {25; 	long long tv_sec;26; 	int tv_usec;27; };28;29; ptr memset(ptr, int, size_t);30; void foo(void);31;32; static void33; bar(int value)34; {35; 	struct timeval lifetime;36;37; 	memset(&lifetime, 0, sizeof(struct timeval));38; 	lifetime.tv_sec = value;39;40; 	foo();41; }42;43; int44; parse_config_file(void)45; {46; 	int value;47;48; 	bar(value);49; 	return (0);50; }51 52target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"53target triple = "armv4t--freebsd11.0-gnueabi"54 55%struct.timeval = type { i64, i32 }56 57declare void @llvm.dbg.declare(metadata, metadata, metadata)58declare void @llvm.dbg.value(metadata, metadata, metadata)59 60declare void @foo()61 62define i32 @parse_config_file() !dbg !4 {63entry:64  tail call void @llvm.dbg.value(metadata i32 0, metadata !15, metadata !26), !dbg !2765  tail call void @llvm.dbg.declare(metadata ptr undef, metadata !16, metadata !26), !dbg !2966  tail call void @llvm.dbg.value(metadata i64 0, metadata !16, metadata !30), !dbg !2967  tail call void @llvm.dbg.value(metadata i32 0, metadata !16, metadata !31), !dbg !2968  tail call void @foo() #3, !dbg !3269  ret i32 0, !dbg !3370}71 72 73!llvm.dbg.cu = !{!0}74!llvm.module.flags = !{!22, !23, !24}75!llvm.ident = !{!25}76 77!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)78!1 = !DIFile(filename: "<stdin>", directory: "/home/ubuntu/bugs")79!2 = !{}80!4 = distinct !DISubprogram(name: "parse_config_file", scope: !5, file: !5, line: 22, type: !6, isLocal: false, isDefinition: true, scopeLine: 23, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !9)81!5 = !DIFile(filename: "test.c", directory: "/home/ubuntu/bugs")82!6 = !DISubroutineType(types: !7)83!7 = !{!8}84!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)85!9 = !{!10}86!10 = !DILocalVariable(name: "value", scope: !4, file: !5, line: 24, type: !8)87!11 = distinct !DISubprogram(name: "bar", scope: !5, file: !5, line: 11, type: !12, isLocal: true, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !14)88!12 = !DISubroutineType(types: !13)89!13 = !{null, !8}90!14 = !{!15, !16}91!15 = !DILocalVariable(name: "value", arg: 1, scope: !11, file: !5, line: 11, type: !8)92!16 = !DILocalVariable(name: "lifetime", scope: !11, file: !5, line: 13, type: !17)93!17 = !DICompositeType(tag: DW_TAG_structure_type, name: "timeval", file: !5, line: 2, size: 128, align: 64, elements: !18)94!18 = !{!19, !21}95!19 = !DIDerivedType(tag: DW_TAG_member, name: "tv_sec", scope: !17, file: !5, line: 3, baseType: !20, size: 64, align: 64)96!20 = !DIBasicType(name: "long long int", size: 64, align: 64, encoding: DW_ATE_signed)97!21 = !DIDerivedType(tag: DW_TAG_member, name: "tv_usec", scope: !17, file: !5, line: 4, baseType: !8, size: 32, align: 32, offset: 64)98!22 = !{i32 2, !"Debug Info Version", i32 3}99!23 = !{i32 1, !"wchar_size", i32 4}100!24 = !{i32 1, !"min_enum_size", i32 4}101!25 = !{!"clang version 3.9.0"}102!26 = !DIExpression()103!27 = !DILocation(line: 11, scope: !11, inlinedAt: !28)104!28 = distinct !DILocation(line: 26, scope: !4)105!29 = !DILocation(line: 13, scope: !11, inlinedAt: !28)106!30 = !DIExpression(DW_OP_LLVM_fragment, 0, 64)107!31 = !DIExpression(DW_OP_LLVM_fragment, 0, 32)108!32 = !DILocation(line: 18, scope: !11, inlinedAt: !28)109!33 = !DILocation(line: 27, scope: !4)110