brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · d86debf Raw
63 lines · plain
1; RUN: llc -dwarf-version=4 -filetype=obj -O0 \2; RUN:     -mtriple=x86_64-unknown-linux-gnu < %s \3; RUN:     | llvm-dwarfdump -v - | FileCheck %s4 5; Verify that the empty DW_OP_piece operations that are created for the6; optimized-out struct fields `foo' and `baz' are emitted before their7; succeeding fields' symbol location expressions.8 9; Test file based on foo.c:10;11; struct {12;   long foo;13;   void *bar;14;   long baz;15;   void *qux;16; } static var;17; 18; void *ptr;19; 20; int main() {21;   if (var.foo == 0)22;     var.bar = var.qux = ptr;23;   return 0;24; }25;26; which was built using:27;28; clang -O0 -g2 -S -emit-llvm foo.c -o foo.ll29; opt -S -globalopt foo.ll -o foo.opt.ll30 31; CHECK: DW_AT_name {{.*}}"var"32; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_piece 0x8, DW_OP_addr 0x0, DW_OP_piece 0x8, DW_OP_piece 0x8, DW_OP_addr 0x0, DW_OP_piece 0x8)33 34target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"35target triple = "x86_64-unknown-linux-gnu"36 37@var.1 = internal unnamed_addr global ptr null, align 8, !dbg !038@var.3 = internal unnamed_addr global ptr null, align 8, !dbg !1539 40!llvm.dbg.cu = !{!2}41!llvm.module.flags = !{!16, !17}42!llvm.ident = !{!18}43 44!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression(DW_OP_LLVM_fragment, 64, 64))45!1 = distinct !DIGlobalVariable(name: "var", scope: !2, file: !3, line: 15, type: !7, isLocal: true, isDefinition: true)46!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)47!3 = !DIFile(filename: "foo.c", directory: "/")48!4 = !{}49!5 = !{!6}50!6 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())51!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !3, line: 10, size: 256, elements: !8)52!8 = !{!9, !11, !13, !14}53!9 = !DIDerivedType(tag: DW_TAG_member, name: "foo", scope: !7, file: !3, line: 11, baseType: !10, size: 64)54!10 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)55!11 = !DIDerivedType(tag: DW_TAG_member, name: "bar", scope: !7, file: !3, line: 12, baseType: !12, size: 64, offset: 64)56!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)57!13 = !DIDerivedType(tag: DW_TAG_member, name: "baz", scope: !7, file: !3, line: 13, baseType: !10, size: 64, offset: 128)58!14 = !DIDerivedType(tag: DW_TAG_member, name: "qux", scope: !7, file: !3, line: 14, baseType: !12, size: 64, offset: 192)59!15 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression(DW_OP_LLVM_fragment, 192, 64))60!16 = !{i32 2, !"Dwarf Version", i32 4}61!17 = !{i32 2, !"Debug Info Version", i32 3}62!18 = !{!"clang version 7.0.0"}63