1; REQUIRES: x86-registered-target 2; RUN: llvm-as < %s | llvm-dis | FileCheck %s 3 4%struct.t1 = type { i32 } 5%struct.t2 = type { i8, [3 x i8] } 6 7; Function Attrs: noinline nounwind optnone uwtable 8define dso_local i32 @foo(%struct.t1* %arg) #0 !dbg !9 { 9entry: 10 %arg.addr = alloca %struct.t1*, align 8 11 store %struct.t1* %arg, %struct.t1** %arg.addr, align 8 12 call void @llvm.dbg.declare(metadata %struct.t1** %arg.addr, metadata !20, metadata !DIExpression()), !dbg !21 13 %0 = load %struct.t1*, %struct.t1** %arg.addr, align 8, !dbg !22 14 %a = getelementptr inbounds %struct.t1, %struct.t1* %0, i32 0, i32 0, !dbg !23 15 %1 = load i32, i32* %a, align 4, !dbg !23 16 ret i32 %1, !dbg !24 17} 18 19; Function Attrs: nofree nosync nounwind readnone speculatable willreturn 20declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 21 22; Function Attrs: noinline nounwind optnone uwtable 23define dso_local i32 @foo2(%struct.t2* %arg) #0 !dbg !25 { 24entry: 25 %arg.addr = alloca %struct.t2*, align 8 26 store %struct.t2* %arg, %struct.t2** %arg.addr, align 8 27 call void @llvm.dbg.declare(metadata %struct.t2** %arg.addr, metadata !32, metadata !DIExpression()), !dbg !33 28 %0 = load %struct.t2*, %struct.t2** %arg.addr, align 8, !dbg !34 29 %1 = bitcast %struct.t2* %0 to i8*, !dbg !35 30 %bf.load = load i8, i8* %1, align 4, !dbg !35 31 %bf.shl = shl i8 %bf.load, 7, !dbg !35 32 %bf.ashr = ashr i8 %bf.shl, 7, !dbg !35 33 %bf.cast = sext i8 %bf.ashr to i32, !dbg !35 34 ret i32 %bf.cast, !dbg !36 35} 36 37attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } 38attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } 39 40!llvm.dbg.cu = !{!0} 41!llvm.module.flags = !{!3, !4, !5, !6, !7} 42!llvm.ident = !{!8} 43 44!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 14.0.0 (https://github.com/llvm/llvm-project.git 4cbaee98885ead226304e8836090069db6596965)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) 45!1 = !DIFile(filename: "attr-btf_tag-field.c", directory: "/home/yhs/work/tests/llvm/btf_tag") 46!2 = !{} 47!3 = !{i32 7, !"Dwarf Version", i32 4} 48!4 = !{i32 2, !"Debug Info Version", i32 3} 49!5 = !{i32 1, !"wchar_size", i32 4} 50!6 = !{i32 7, !"uwtable", i32 1} 51!7 = !{i32 7, !"frame-pointer", i32 2} 52!8 = !{!"clang version 14.0.0 (https://github.com/llvm/llvm-project.git 4cbaee98885ead226304e8836090069db6596965)"} 53!9 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 11, type: !10, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) 54!10 = !DISubroutineType(types: !11) 55!11 = !{!12, !13} 56!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 57!13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !14, size: 64) 58!14 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", file: !1, line: 7, size: 32, elements: !15) 59!15 = !{!16} 60!16 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !14, file: !1, line: 8, baseType: !12, size: 32, annotations: !17) 61!17 = !{!18, !19} 62!18 = !{!"btf_decl_tag", !"tag1"} 63!19 = !{!"btf_decl_tag", !"tag2"} 64 65; CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a" 66; CHECK-SAME: annotations: ![[ANNOT:[0-9]+]] 67; CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]} 68; CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"} 69; CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"} 70 71!20 = !DILocalVariable(name: "arg", arg: 1, scope: !9, file: !1, line: 11, type: !13) 72!21 = !DILocation(line: 11, column: 20, scope: !9) 73!22 = !DILocation(line: 12, column: 10, scope: !9) 74!23 = !DILocation(line: 12, column: 15, scope: !9) 75!24 = !DILocation(line: 12, column: 3, scope: !9) 76!25 = distinct !DISubprogram(name: "foo2", scope: !1, file: !1, line: 19, type: !26, scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) 77!26 = !DISubroutineType(types: !27) 78!27 = !{!12, !28} 79!28 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !29, size: 64) 80!29 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t2", file: !1, line: 15, size: 32, elements: !30) 81!30 = !{!31} 82!31 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !29, file: !1, line: 16, baseType: !12, size: 1, flags: DIFlagBitField, extraData: i64 0, annotations: !17) 83 84; CHECK: !DIDerivedType(tag: DW_TAG_member, name: "b" 85; CHECK-SAME: annotations: ![[ANNOT]] 86 87!32 = !DILocalVariable(name: "arg", arg: 1, scope: !25, file: !1, line: 19, type: !28) 88!33 = !DILocation(line: 19, column: 21, scope: !25) 89!34 = !DILocation(line: 20, column: 10, scope: !25) 90!35 = !DILocation(line: 20, column: 15, scope: !25) 91!36 = !DILocation(line: 20, column: 3, scope: !25) 92