brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.2 KiB · 3850d8f Raw
140 lines · plain
1; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump --name resource - | FileCheck %s2; CHECK: DW_TAG_formal_parameter3; CHECK: DW_TAG_formal_parameter4; CHECK-NEXT:  DW_AT_location	(DW_OP_reg1 W1)5; CHECK-NEXT:  DW_AT_abstract_origin {{.*}}"resource"6;7; Inlined variable "resource"/!37 covers all blocks in its lexical scope. Check8; that it is given a single location.9;10; Generated from:11; typedef struct t *t_t;12; extern unsigned int enable;13; struct t ptr tt;14; static unsigned long find(t_t t, unsigned long long resource) {15;   struct q *q;16;   q = t->s;17;   while (q) {18;     if (q->resource == resource)19;       return q;20;     q = q->next;21;   }22; }23; int g(t_t t, unsigned long long r) {24;   struct q *q;25;   q = find(t, r);26;   if (!q)27;     if (__builtin_expect(enable, 0)) {  }28; }29 30; ModuleID = 'inlined-arg.c'31source_filename = "inlined-arg.c"32target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"33target triple = "arm64-apple-ios5.0.0"34 35%struct.t = type { ptr }36%struct.q = type { ptr, i64 }37 38@tt = common local_unnamed_addr global ptr null, align 8, !dbg !039 40; Function Attrs: norecurse nounwind readonly ssp uwtable41define i32 @g(ptr nocapture readonly %t, i64 %r) local_unnamed_addr !dbg !21 {42entry:43  call void @llvm.dbg.value(metadata ptr %t, metadata !27, metadata !DIExpression()), !dbg !3044  call void @llvm.dbg.value(metadata i64 %r, metadata !28, metadata !DIExpression()), !dbg !3145  call void @llvm.dbg.value(metadata ptr %t, metadata !32, metadata !DIExpression()), !dbg !3946  call void @llvm.dbg.value(metadata i64 %r, metadata !37, metadata !DIExpression()), !dbg !4147  %q.05.i = load ptr, ptr %t, align 8, !dbg !43, !tbaa !4448  call void @llvm.dbg.value(metadata ptr %q.05.i, metadata !38, metadata !DIExpression()), !dbg !4849  %tobool6.i = icmp eq ptr %q.05.i, null, !dbg !4950  br i1 %tobool6.i, label %find.exit, label %while.body.i, !dbg !4951 52while.body.i:                                     ; preds = %entry, %if.end.i53  %q.07.i = phi ptr [ %q.0.i, %if.end.i ], [ %q.05.i, %entry ]54  %resource1.i = getelementptr inbounds %struct.q, ptr %q.07.i, i64 0, i32 1, !dbg !5055  %0 = load i64, ptr %resource1.i, align 8, !dbg !50, !tbaa !5356  %cmp.i = icmp eq i64 %0, %r, !dbg !5657  br i1 %cmp.i, label %find.exit, label %if.end.i, !dbg !5758 59if.end.i:                                         ; preds = %while.body.i60  %q.0.i = load ptr, ptr %q.07.i, align 8, !dbg !43, !tbaa !4461  call void @llvm.dbg.value(metadata ptr %q.0.i, metadata !38, metadata !DIExpression()), !dbg !4862  %tobool.i = icmp eq ptr %q.0.i, null, !dbg !4963  br i1 %tobool.i, label %find.exit, label %while.body.i, !dbg !49, !llvm.loop !5964 65find.exit:                                        ; preds = %while.body.i, %if.end.i, %entry66  call void @llvm.dbg.value(metadata ptr undef, metadata !29, metadata !DIExpression()), !dbg !6167  ret i32 undef, !dbg !6268}69 70; Function Attrs: nounwind readnone speculatable71declare void @llvm.dbg.value(metadata, metadata, metadata)72 73!llvm.dbg.cu = !{!2}74!llvm.module.flags = !{!16, !17, !18, !19}75!llvm.ident = !{!20}76 77!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())78!1 = distinct !DIGlobalVariable(name: "tt", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true)79!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 9.0.0 (https://github.com/llvm/llvm-project.git cd3671d5dabc8848619d872f994770167a44ac5a)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: GNU)80!3 = !DIFile(filename: "inlined-arg.c", directory: "")81!4 = !{}82!5 = !{!0}83!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64)84!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t", file: !3, line: 3, size: 64, elements: !8)85!8 = !{!9}86!9 = !DIDerivedType(tag: DW_TAG_member, name: "s", scope: !7, file: !3, line: 7, baseType: !10, size: 64)87!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)88!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "q", file: !3, line: 4, size: 128, elements: !12)89!12 = !{!13, !14}90!13 = !DIDerivedType(tag: DW_TAG_member, name: "next", scope: !11, file: !3, line: 5, baseType: !10, size: 64)91!14 = !DIDerivedType(tag: DW_TAG_member, name: "resource", scope: !11, file: !3, line: 6, baseType: !15, size: 64, offset: 64)92!15 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned)93!16 = !{i32 2, !"Dwarf Version", i32 2}94!17 = !{i32 2, !"Debug Info Version", i32 3}95!18 = !{i32 1, !"wchar_size", i32 4}96!19 = !{i32 7, !"PIC Level", i32 2}97!20 = !{!"clang version 9.0.0 (https://github.com/llvm/llvm-project.git cd3671d5dabc8848619d872f994770167a44ac5a)"}98!21 = distinct !DISubprogram(name: "g", scope: !3, file: !3, line: 19, type: !22, scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !26)99!22 = !DISubroutineType(types: !23)100!23 = !{!24, !25, !15}101!24 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)102!25 = !DIDerivedType(tag: DW_TAG_typedef, name: "t_t", file: !3, line: 1, baseType: !6)103!26 = !{!27, !28, !29}104!27 = !DILocalVariable(name: "t", arg: 1, scope: !21, file: !3, line: 19, type: !25)105!28 = !DILocalVariable(name: "r", arg: 2, scope: !21, file: !3, line: 19, type: !15)106!29 = !DILocalVariable(name: "q", scope: !21, file: !3, line: 20, type: !10)107!30 = !DILocation(line: 19, column: 11, scope: !21)108!31 = !DILocation(line: 19, column: 33, scope: !21)109!32 = !DILocalVariable(name: "t", arg: 1, scope: !33, file: !3, line: 10, type: !25)110!33 = distinct !DISubprogram(name: "find", scope: !3, file: !3, line: 10, type: !34, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !36)111!34 = !DISubroutineType(types: !35)112!35 = !{!10, !25, !15}113!36 = !{!32, !37, !38}114!37 = !DILocalVariable(name: "resource", arg: 2, scope: !33, file: !3, line: 10, type: !15)115!38 = !DILocalVariable(name: "q", scope: !33, file: !3, line: 11, type: !10)116!39 = !DILocation(line: 10, column: 27, scope: !33, inlinedAt: !40)117!40 = distinct !DILocation(line: 21, column: 7, scope: !21)118!41 = !DILocation(line: 10, column: 49, scope: !33, inlinedAt: !40)119!42 = !DILocation(line: 12, column: 10, scope: !33, inlinedAt: !40)120!43 = !DILocation(line: 0, scope: !33, inlinedAt: !40)121!44 = !{!45, !45, i64 0}122!45 = !{!"any pointer", !46, i64 0}123!46 = !{!"omnipotent char", !47, i64 0}124!47 = !{!"Simple C/C++ TBAA"}125!48 = !DILocation(line: 11, column: 13, scope: !33, inlinedAt: !40)126!49 = !DILocation(line: 13, column: 3, scope: !33, inlinedAt: !40)127!50 = !DILocation(line: 14, column: 12, scope: !51, inlinedAt: !40)128!51 = distinct !DILexicalBlock(scope: !52, file: !3, line: 14, column: 9)129!52 = distinct !DILexicalBlock(scope: !33, file: !3, line: 13, column: 13)130!53 = !{!54, !55, i64 8}131!54 = !{!"q", !45, i64 0, !55, i64 8}132!55 = !{!"long long", !46, i64 0}133!56 = !DILocation(line: 14, column: 21, scope: !51, inlinedAt: !40)134!57 = !DILocation(line: 14, column: 9, scope: !52, inlinedAt: !40)135!58 = !DILocation(line: 16, column: 12, scope: !52, inlinedAt: !40)136!59 = distinct !{!59, !49, !60}137!60 = !DILocation(line: 17, column: 3, scope: !33, inlinedAt: !40)138!61 = !DILocation(line: 20, column: 13, scope: !21)139!62 = !DILocation(line: 24, column: 1, scope: !21)140