|
| 1 | +; RUN: llc -mtriple arm64-apple-darwin -filetype=obj %s -o %t |
| 2 | +; RUN: llvm-dwarfdump -all %t | FileCheck %s |
| 3 | + |
| 4 | +; Checks that bit sizes that are not byte aligned are rounded up. |
| 5 | + |
| 6 | +; Check that a 1 bit sized type gets emitted as 1 bit long. |
| 7 | +; CHECK: DW_AT_name ("one_bit_int") |
| 8 | +; CHECK-NEXT: DW_AT_encoding (DW_ATE_signed) |
| 9 | +; CHECK-NEXT: DW_AT_bit_size (0x01) |
| 10 | + |
| 11 | +; Check that a 9 bit sized type gets emitted as 2 bytes long. |
| 12 | +; CHECK: DW_AT_name ("nine_bit_double") |
| 13 | +; CHECK-NEXT: DW_AT_encoding (DW_ATE_float) |
| 14 | +; CHECK-NEXT: DW_AT_bit_size (0x09) |
| 15 | + |
| 16 | +; Check that a 7 bit sized type gets emitted as 1 bytes long. |
| 17 | +; CHECK: DW_AT_name ("seven_bit_float") |
| 18 | +; CHECK-NEXT: DW_AT_encoding (DW_ATE_float) |
| 19 | +; CHECK-NEXT: DW_AT_bit_size (0x07) |
| 20 | + |
| 21 | +; Check that a byte aligned bit size is emitted with the same byte size. |
| 22 | +; CHECK: DW_AT_name ("four_byte_S") |
| 23 | +; CHECK-NEXT: DW_AT_byte_size (0x04) |
| 24 | + |
| 25 | +%struct.S = type { i32 } |
| 26 | + |
| 27 | +; Function Attrs: noinline nounwind optnone ssp uwtable(sync) |
| 28 | +define void @func(i32 noundef %a, double noundef %b, float noundef %c, i64 %s.coerce) !dbg !10 { |
| 29 | +entry: |
| 30 | + %s = alloca %struct.S, align 4 |
| 31 | + %a.addr = alloca i32, align 4 |
| 32 | + %b.addr = alloca double, align 8 |
| 33 | + %c.addr = alloca float, align 4 |
| 34 | + call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !20, metadata !DIExpression()), !dbg !21 |
| 35 | + call void @llvm.dbg.declare(metadata ptr %b.addr, metadata !22, metadata !DIExpression()), !dbg !23 |
| 36 | + call void @llvm.dbg.declare(metadata ptr %c.addr, metadata !24, metadata !DIExpression()), !dbg !25 |
| 37 | + call void @llvm.dbg.declare(metadata ptr %s, metadata !26, metadata !DIExpression()), !dbg !27 |
| 38 | + ret void, !dbg !28 |
| 39 | +} |
| 40 | + |
| 41 | +; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) |
| 42 | +declare void @llvm.dbg.declare(metadata, metadata, metadata) |
| 43 | + |
| 44 | +!llvm.module.flags = !{!2} |
| 45 | +!llvm.dbg.cu = !{!7} |
| 46 | + |
| 47 | +!2 = !{i32 2, !"Debug Info Version", i32 3} |
| 48 | +!7 = distinct !DICompileUnit(language: DW_LANG_C11, file: !8, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) |
| 49 | +!8 = !DIFile(filename: "t.c", directory: "") |
| 50 | +!10 = distinct !DISubprogram(name: "func", scope: !8, file: !8, line: 6, type: !11, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !7, retainedNodes: !19) |
| 51 | +!11 = !DISubroutineType(types: !12) |
| 52 | +!12 = !{null, !13, !14, !15, !16} |
| 53 | +!13 = !DIBasicType(name: "one_bit_int", size: 1, encoding: DW_ATE_signed) |
| 54 | +!14 = !DIBasicType(name: "nine_bit_double", size: 9, encoding: DW_ATE_float) |
| 55 | +!15 = !DIBasicType(name: "seven_bit_float", size: 7, encoding: DW_ATE_float) |
| 56 | +!16 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "four_byte_S", file: !8, line: 2, size: 32, elements: !17) |
| 57 | +!17 = !{!18} |
| 58 | +!18 = !DIDerivedType(tag: DW_TAG_member, name: "field", scope: !16, file: !8, line: 3, baseType: !13, size: 32) |
| 59 | +!19 = !{} |
| 60 | +!20 = !DILocalVariable(name: "a", arg: 1, scope: !10, file: !8, line: 6, type: !13) |
| 61 | +!21 = !DILocation(line: 6, column: 15, scope: !10) |
| 62 | +!22 = !DILocalVariable(name: "b", arg: 2, scope: !10, file: !8, line: 6, type: !14) |
| 63 | +!23 = !DILocation(line: 6, column: 25, scope: !10) |
| 64 | +!24 = !DILocalVariable(name: "c", arg: 3, scope: !10, file: !8, line: 6, type: !15) |
| 65 | +!25 = !DILocation(line: 6, column: 34, scope: !10) |
| 66 | +!26 = !DILocalVariable(name: "s", arg: 4, scope: !10, file: !8, line: 6, type: !16) |
| 67 | +!27 = !DILocation(line: 6, column: 46, scope: !10) |
| 68 | +!28 = !DILocation(line: 7, column: 1, scope: !10) |
| 69 | + |
0 commit comments