1; REQUIRES: x86_64-linux 2; RUN: opt < %s -passes='pseudo-probe,cgscc(inline)' -function-sections -mtriple=x86_64-unknown-linux-gnu -S -o %t 3; RUN: FileCheck %s < %t --check-prefix=CHECK-IL 4; RUN: llc -function-sections <%t -filetype=asm -o %t1 5; RUN: FileCheck %s < %t1 --check-prefix=CHECK-ASM 6; RUN: llc -function-sections <%t -filetype=obj -o %t2 7; RUN: llvm-objdump --section-headers %t2 | FileCheck %s --check-prefix=CHECK-OBJ 8; RUN: llvm-mc -filetype=asm <%t1 -o %t3 9; RUN: FileCheck %s < %t3 --check-prefix=CHECK-ASM 10; RUN: llvm-mc -filetype=obj <%t1 -o %t4 11; RUN: llvm-objdump --section-headers %t4 | FileCheck %s --check-prefix=CHECK-OBJ 12 13define dso_local void @foo2() !dbg !7 { 14; CHECK-IL: call void @llvm.pseudoprobe(i64 [[#GUID1:]], i64 1, i32 0, i64 -1), !dbg ![[#]] 15; CHECK-ASM: .pseudoprobe [[#GUID1:]] 1 0 0 16 ret void, !dbg !10 17} 18 19define dso_local void @foo() #0 !dbg !11 { 20; CHECK-IL: call void @llvm.pseudoprobe(i64 [[#GUID2:]], i64 1, i32 0, i64 -1), !dbg ![[#]] 21; CHECK-IL: call void @llvm.pseudoprobe(i64 [[#GUID1]], i64 1, i32 0, i64 -1), !dbg ![[#DL1:]] 22; CHECK-ASM: .pseudoprobe [[#GUID2:]] 1 0 0 23; CHECK-ASM: .pseudoprobe [[#GUID1]] 1 0 0 @ [[#GUID2]]:2 24 call void @foo2(), !dbg !12 25 ret void, !dbg !13 26} 27 28define dso_local i32 @entry() !dbg !14 { 29; CHECK-IL: call void @llvm.pseudoprobe(i64 [[#GUID3:]], i64 1, i32 0, i64 -1), !dbg ![[#]] 30; CHECK-IL: call void @llvm.pseudoprobe(i64 [[#GUID2]], i64 1, i32 0, i64 -1), !dbg ![[#DL2:]] 31; CHECK-IL: call void @llvm.pseudoprobe(i64 [[#GUID1]], i64 1, i32 0, i64 -1), !dbg ![[#DL3:]] 32; CHECK-ASM: .pseudoprobe [[#GUID3:]] 1 0 0 33; CHECK-ASM: .pseudoprobe [[#GUID2]] 1 0 0 @ [[#GUID3]]:2 34; CHECK-ASM: .pseudoprobe [[#GUID1]] 1 0 0 @ [[#GUID3]]:2 @ [[#GUID2]]:2 35 call void @foo(), !dbg !18 36 ret i32 0, !dbg !19 37} 38 39 40; CHECK-IL: ![[#SCOPE1:]] = distinct !DISubprogram(name: "foo2" 41; CHECK-IL: ![[#SCOPE2:]] = distinct !DISubprogram(name: "foo" 42; CHECK-IL: ![[#DL1]] = !DILocation(line: 3, column: 1, scope: ![[#SCOPE1]], inlinedAt: ![[#INL1:]]) 43; CHECK-IL: ![[#INL1]] = distinct !DILocation(line: 7, column: 3, scope: ![[#BL1:]]) 44;; A discriminator of 186646551 which is 0xb200017 in hexdecimal, stands for a direct call probe 45;; with an index of 2 and a scale of 100%. 46; CHECK-IL: ![[#BL1]] = !DILexicalBlockFile(scope: ![[#SCOPE2]], file: !1, discriminator: 186646551) 47; CHECK-IL: ![[#SCOPE3:]] = distinct !DISubprogram(name: "entry" 48; CHECK-IL: ![[#DL2]] = !DILocation(line: 7, column: 3, scope: ![[#SCOPE2]], inlinedAt: ![[#INL2:]]) 49; CHECK-IL: ![[#INL2]] = distinct !DILocation(line: 11, column: 3, scope: ![[#BL2:]]) 50; CHECK-IL: ![[#BL2]] = !DILexicalBlockFile(scope: ![[#SCOPE3]], file: !1, discriminator: 186646551) 51; CHECK-IL: ![[#DL3]] = !DILocation(line: 3, column: 1, scope: ![[#SCOPE1]], inlinedAt: ![[#INL3:]]) 52; CHECK-IL: ![[#INL3]] = distinct !DILocation(line: 7, column: 3, scope: ![[#BL1]], inlinedAt: ![[#INL2]]) 53 54 55; Check the generation of .pseudo_probe_desc section 56; CHECK-ASM: .section .pseudo_probe_desc,"G",@progbits,.pseudo_probe_desc_foo2,comdat 57; CHECK-ASM-NEXT: .quad [[#GUID1]] 58; CHECK-ASM-NEXT: .quad [[#HASH1:]] 59; CHECK-ASM-NEXT: .byte 4 60; CHECK-ASM-NEXT: .ascii "foo2" 61; CHECK-ASM-NEXT: .section .pseudo_probe_desc,"G",@progbits,.pseudo_probe_desc_foo,comdat 62; CHECK-ASM-NEXT: .quad [[#GUID2]] 63; CHECK-ASM-NEXT: .quad [[#HASH2:]] 64; CHECK-ASM-NEXT: .byte 3 65; CHECK-ASM-NEXT: .ascii "foo" 66; CHECK-ASM-NEXT: .section .pseudo_probe_desc,"G",@progbits,.pseudo_probe_desc_entry,comdat 67; CHECK-ASM-NEXT: .quad [[#GUID3]] 68; CHECK-ASM-NEXT: .quad [[#HASH3:]] 69; CHECK-ASM-NEXT: .byte 5 70; CHECK-ASM-NEXT: .ascii "entry" 71 72; CHECK-OBJ: .pseudo_probe_desc 73; CHECK-OBJ: .pseudo_probe 74 75!llvm.dbg.cu = !{!0} 76!llvm.module.flags = !{!3, !4} 77 78!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug) 79!1 = !DIFile(filename: "foo.c", directory: "any") 80!2 = !{} 81!3 = !{i32 2, !"Dwarf Version", i32 4} 82!4 = !{i32 2, !"Debug Info Version", i32 3} 83!7 = distinct !DISubprogram(name: "foo2", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) 84!8 = !DISubroutineType(types: !9) 85!9 = !{null} 86!10 = !DILocation(line: 3, column: 1, scope: !7) 87!11 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 6, type: !8, scopeLine: 6, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) 88!12 = !DILocation(line: 7, column: 3, scope: !11) 89!13 = !DILocation(line: 8, column: 1, scope: !11) 90!14 = distinct !DISubprogram(name: "entry", scope: !1, file: !1, line: 10, type: !15, scopeLine: 10, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) 91!15 = !DISubroutineType(types: !16) 92!16 = !{!17} 93!17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 94!18 = !DILocation(line: 11, column: 3, scope: !14) 95!19 = !DILocation(line: 12, column: 3, scope: !14) 96