brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 1eecb0d Raw
67 lines · plain
1; RUN: llc -mtriple=x86_64-apple-darwin %s -o - -filetype=obj | llvm-dwarfdump - | FileCheck %s2 3; CHECK: 0x00000[[G:.*]]:     DW_TAG_variable4; CHECK-NEXT:                DW_AT_name	("g")5; CHECK: DW_TAG_array_type6; CHECK-NEXT:  DW_AT_type	({{.*}} "int")7; CHECK-NOT: DW_TAG8; CHECK:       DW_TAG_subrange_type9; CHECK-NEXT:     DW_AT_type	({{.*}} "__ARRAY_SIZE_TYPE__")10; CHECK-NEXT:      DW_AT_count	(0x00000[[G]])11; Test that a VLA referring to a global variable is handled correctly.12; Clang doesn't generate this, but the verifier allows it.13source_filename = "/tmp/test.c"14target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"15target triple = "x86_64-apple-macosx10.13.0"16 17@g = common local_unnamed_addr global i32 0, align 4, !dbg !018 19define void @f() !dbg !12 {20entry:21  %0 = load i32, ptr @g, align 4, !dbg !2222  %1 = zext i32 %0 to i64, !dbg !2223  %vla = alloca i32, i64 %1, align 16, !dbg !2224  call void @llvm.dbg.declare(metadata ptr %vla, metadata !16, metadata !DIExpression()), !dbg !2225  call void @llvm.dbg.value(metadata i32 2, metadata !21, metadata !DIExpression()), !dbg !2226  %call = call i32 (ptr, ...) @use(ptr nonnull %vla), !dbg !2227  ret void, !dbg !2228}29 30; Function Attrs: nounwind readnone speculatable31declare void @llvm.dbg.declare(metadata, metadata, metadata) #032 33declare i32 @use(...) local_unnamed_addr34 35; Function Attrs: nounwind readnone speculatable36declare void @llvm.dbg.value(metadata, metadata, metadata) #037 38attributes #0 = { nounwind readnone speculatable }39 40!llvm.dbg.cu = !{!2}41!llvm.module.flags = !{!7, !8, !9, !10}42!llvm.ident = !{!11}43 44!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())45!1 = distinct !DIGlobalVariable(name: "g", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)46!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (trunk 324259) (llvm/trunk 324261)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)47!3 = !DIFile(filename: "/tmp/test.c", directory: "/")48!4 = !{}49!5 = !{!0}50!6 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)51!7 = !{i32 2, !"Dwarf Version", i32 4}52!8 = !{i32 2, !"Debug Info Version", i32 3}53!9 = !{i32 1, !"wchar_size", i32 4}54!10 = !{i32 7, !"PIC Level", i32 2}55!11 = !{!"clang version 7.0.0 (trunk 324259) (llvm/trunk 324261)"}56!12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 3, type: !13, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !2, retainedNodes: !15)57!13 = !DISubroutineType(types: !14)58!14 = !{null}59!15 = !{!16, !21}60!16 = !DILocalVariable(name: "array", scope: !12, file: !3, line: 4, type: !17)61!17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, elements: !19)62!18 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)63!19 = !{!20}64!20 = !DISubrange(count: !1)65!21 = !DILocalVariable(name: "count", scope: !12, file: !3, line: 5, type: !18)66!22 = !DILocation(line: 7, column: 1, scope: !12)67