|
| 1 | +; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump --name resource - | FileCheck %s |
| 2 | +; CHECK: DW_TAG_formal_parameter |
| 3 | +; CHECK: DW_TAG_formal_parameter |
| 4 | +; CHECK-NEXT: DW_AT_location (DW_OP_reg1 W1) |
| 5 | +; CHECK-NEXT: DW_AT_abstract_origin {{.*}}"resource" |
| 6 | +; |
| 7 | +; Generated from: |
| 8 | +; typedef struct t *t_t; |
| 9 | +; extern unsigned int enable; |
| 10 | +; struct t { |
| 11 | +; struct q { |
| 12 | +; struct q *next; |
| 13 | +; unsigned long long resource; |
| 14 | +; } * s; |
| 15 | +; } * tt; |
| 16 | +; static unsigned long find(t_t t, unsigned long long resource) { |
| 17 | +; struct q *q; |
| 18 | +; q = t->s; |
| 19 | +; while (q) { |
| 20 | +; if (q->resource == resource) |
| 21 | +; return q; |
| 22 | +; q = q->next; |
| 23 | +; } |
| 24 | +; } |
| 25 | +; int g(t_t t, unsigned long long r) { |
| 26 | +; struct q *q; |
| 27 | +; q = find(t, r); |
| 28 | +; if (!q) |
| 29 | +; if (__builtin_expect(enable, 0)) { } |
| 30 | +; } |
| 31 | + |
| 32 | + |
| 33 | +source_filename = "test.i" |
| 34 | +target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" |
| 35 | +target triple = "arm64-apple-ios5.0.0" |
| 36 | + |
| 37 | +%struct.t = type { %struct.q* } |
| 38 | +%struct.q = type { %struct.q*, i64 } |
| 39 | + |
| 40 | +@tt = local_unnamed_addr global %struct.t* null, align 8, !dbg !0 |
| 41 | + |
| 42 | +; Function Attrs: noredzone nounwind readonly ssp |
| 43 | +define i32 @g(%struct.t* nocapture readonly %t, i64 %r) local_unnamed_addr #0 !dbg !20 { |
| 44 | +entry: |
| 45 | + tail call void @llvm.dbg.value(metadata %struct.t* %t, metadata !26, metadata !DIExpression()), !dbg !29 |
| 46 | + tail call void @llvm.dbg.value(metadata i64 %r, metadata !27, metadata !DIExpression()), !dbg !30 |
| 47 | + tail call void @llvm.dbg.value(metadata %struct.t* %t, metadata !31, metadata !DIExpression()), !dbg !39 |
| 48 | + tail call void @llvm.dbg.value(metadata i64 %r, metadata !37, metadata !DIExpression()), !dbg !41 |
| 49 | + %s.i5 = bitcast %struct.t* %t to %struct.q** |
| 50 | + tail call void @llvm.dbg.value(metadata %struct.q** %s.i5, metadata !38, metadata !DIExpression(DW_OP_deref)), !dbg !42 |
| 51 | + %q.06.i = load %struct.q*, %struct.q** %s.i5, align 8 |
| 52 | + tail call void @llvm.dbg.value(metadata %struct.q* %q.06.i, metadata !38, metadata !DIExpression()), !dbg !42 |
| 53 | + %tobool7.i = icmp eq %struct.q* %q.06.i, null, !dbg !43 |
| 54 | + br i1 %tobool7.i, label %find.exit, label %while.body.i.preheader, !dbg !43 |
| 55 | + |
| 56 | +while.body.i.preheader: ; preds = %entry |
| 57 | + br label %while.body.i, !dbg !44 |
| 58 | + |
| 59 | +while.body.i: ; preds = %while.body.i.preheader, %if.end.i |
| 60 | + %q.08.i = phi %struct.q* [ %q.0.i, %if.end.i ], [ %q.06.i, %while.body.i.preheader ] |
| 61 | + %resource1.i = getelementptr inbounds %struct.q, %struct.q* %q.08.i, i64 0, i32 1, !dbg !44 |
| 62 | + %0 = load i64, i64* %resource1.i, align 8, !dbg !44 |
| 63 | + %cmp.i = icmp eq i64 %0, %r, !dbg !47 |
| 64 | + br i1 %cmp.i, label %find.exit, label %if.end.i, !dbg !48 |
| 65 | + |
| 66 | +if.end.i: ; preds = %while.body.i |
| 67 | + %next.i6 = bitcast %struct.q* %q.08.i to %struct.q** |
| 68 | + tail call void @llvm.dbg.value(metadata %struct.q** %next.i6, metadata !38, metadata !DIExpression(DW_OP_deref)), !dbg !42 |
| 69 | + %q.0.i = load %struct.q*, %struct.q** %next.i6, align 8 |
| 70 | + tail call void @llvm.dbg.value(metadata %struct.q* %q.0.i, metadata !38, metadata !DIExpression()), !dbg !42 |
| 71 | + %tobool.i = icmp eq %struct.q* %q.0.i, null, !dbg !43 |
| 72 | + br i1 %tobool.i, label %find.exit, label %while.body.i, !dbg !43, !llvm.loop !49 |
| 73 | + |
| 74 | +find.exit: ; preds = %while.body.i, %if.end.i, %entry |
| 75 | + ret i32 undef, !dbg !52 |
| 76 | +} |
| 77 | + |
| 78 | +; Function Attrs: nounwind readnone speculatable |
| 79 | +declare void @llvm.dbg.value(metadata, metadata, metadata) #1 |
| 80 | + |
| 81 | +attributes #0 = { noredzone nounwind readonly ssp } |
| 82 | +attributes #1 = { nounwind readnone speculatable } |
| 83 | + |
| 84 | +!llvm.dbg.cu = !{!2} |
| 85 | +!llvm.module.flags = !{!16, !17, !18} |
| 86 | +!llvm.ident = !{!19} |
| 87 | + |
| 88 | +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
| 89 | +!1 = distinct !DIGlobalVariable(name: "tt", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true) |
| 90 | +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 6.0.0 (trunk 317516) (llvm/trunk 317518)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) |
| 91 | +!3 = !DIFile(filename: "test.i", directory: "/") |
| 92 | +!4 = !{} |
| 93 | +!5 = !{!0} |
| 94 | +!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64) |
| 95 | +!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t", file: !3, line: 3, size: 64, elements: !8) |
| 96 | +!8 = !{!9} |
| 97 | +!9 = !DIDerivedType(tag: DW_TAG_member, name: "s", scope: !7, file: !3, line: 7, baseType: !10, size: 64) |
| 98 | +!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64) |
| 99 | +!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "q", file: !3, line: 4, size: 128, elements: !12) |
| 100 | +!12 = !{!13, !14} |
| 101 | +!13 = !DIDerivedType(tag: DW_TAG_member, name: "next", scope: !11, file: !3, line: 5, baseType: !10, size: 64) |
| 102 | +!14 = !DIDerivedType(tag: DW_TAG_member, name: "resource", scope: !11, file: !3, line: 6, baseType: !15, size: 64, offset: 64) |
| 103 | +!15 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned) |
| 104 | +!16 = !{i32 2, !"Dwarf Version", i32 2} |
| 105 | +!17 = !{i32 2, !"Debug Info Version", i32 3} |
| 106 | +!18 = !{i32 1, !"wchar_size", i32 4} |
| 107 | +!19 = !{!"clang version 6.0.0 (trunk 317516) (llvm/trunk 317518)"} |
| 108 | +!20 = distinct !DISubprogram(name: "g", scope: !3, file: !3, line: 18, type: !21, isLocal: false, isDefinition: true, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !25) |
| 109 | +!21 = !DISubroutineType(types: !22) |
| 110 | +!22 = !{!23, !24, !15} |
| 111 | +!23 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 112 | +!24 = !DIDerivedType(tag: DW_TAG_typedef, name: "t_t", file: !3, line: 1, baseType: !6) |
| 113 | +!25 = !{!26, !27, !28} |
| 114 | +!26 = !DILocalVariable(name: "t", arg: 1, scope: !20, file: !3, line: 18, type: !24) |
| 115 | +!27 = !DILocalVariable(name: "r", arg: 2, scope: !20, file: !3, line: 18, type: !15) |
| 116 | +!28 = !DILocalVariable(name: "q", scope: !20, file: !3, line: 19, type: !10) |
| 117 | +!29 = !DILocation(line: 18, column: 11, scope: !20) |
| 118 | +!30 = !DILocation(line: 18, column: 33, scope: !20) |
| 119 | +!31 = !DILocalVariable(name: "t", arg: 1, scope: !32, file: !3, line: 9, type: !24) |
| 120 | +!32 = distinct !DISubprogram(name: "find", scope: !3, file: !3, line: 9, type: !33, isLocal: true, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !36) |
| 121 | +!33 = !DISubroutineType(types: !34) |
| 122 | +!34 = !{!35, !24, !15} |
| 123 | +!35 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned) |
| 124 | +!36 = !{!31, !37, !38} |
| 125 | +!37 = !DILocalVariable(name: "resource", arg: 2, scope: !32, file: !3, line: 9, type: !15) |
| 126 | +!38 = !DILocalVariable(name: "q", scope: !32, file: !3, line: 10, type: !10) |
| 127 | +!39 = !DILocation(line: 9, column: 31, scope: !32, inlinedAt: !40) |
| 128 | +!40 = distinct !DILocation(line: 20, column: 7, scope: !20) |
| 129 | +!41 = !DILocation(line: 9, column: 53, scope: !32, inlinedAt: !40) |
| 130 | +!42 = !DILocation(line: 10, column: 13, scope: !32, inlinedAt: !40) |
| 131 | +!43 = !DILocation(line: 12, column: 3, scope: !32, inlinedAt: !40) |
| 132 | +!44 = !DILocation(line: 13, column: 12, scope: !45, inlinedAt: !40) |
| 133 | +!45 = distinct !DILexicalBlock(scope: !46, file: !3, line: 13, column: 9) |
| 134 | +!46 = distinct !DILexicalBlock(scope: !32, file: !3, line: 12, column: 13) |
| 135 | +!47 = !DILocation(line: 13, column: 21, scope: !45, inlinedAt: !40) |
| 136 | +!48 = !DILocation(line: 13, column: 9, scope: !46, inlinedAt: !40) |
| 137 | +!49 = distinct !{!49, !50, !51} |
| 138 | +!50 = !DILocation(line: 12, column: 3, scope: !32) |
| 139 | +!51 = !DILocation(line: 16, column: 3, scope: !32) |
| 140 | +!52 = !DILocation(line: 24, column: 1, scope: !20) |
0 commit comments