Debian Codegraph @

llvm/test/Transforms/SampleProfile/csspgo-profile-checksum-mismatch-attr.ll

raw
1 ; REQUIRES: x86_64-linux
2 ; REQUIRES: asserts
3 ; RUN: opt < %s -passes='thinlto-pre-link<O2>' -pgo-kind=pgo-sample-use-pipeline -sample-profile-file=%S/Inputs/pseudo-probe-callee-profile-mismatch.prof -pass-remarks=inline -S -o %t 2>&1 | FileCheck %s --check-prefix=INLINE
4 ; RUN: FileCheck %s < %t
5 ; RUN: FileCheck %s < %t --check-prefix=MERGE
6
7
8 ; Make sure bar is inlined into main for attr merging verification.
9 ; INLINE: 'bar' inlined into 'main'
10
11 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
12 target triple = "x86_64-unknown-linux-gnu"
13
14 define i32 @baz() #0 {
15 entry:
16 ret i32 0
17 }
18
19 define i32 @bar() #0 !dbg !11 {
20 ; CHECK: define {{.*}} @bar() {{.*}} #[[#BAR_ATTR:]] !
21 entry:
22 %call = call i32 @baz()
23 ret i32 0
24 }
25
26 define i32 @main() #0 {
27 ; MERGE: define {{.*}} @main() {{.*}} #[[#MAIN_ATTR:]] !
28 entry:
29 br label %for.cond
30
31 for.cond: ; preds = %for.cond, %entry
32 %call = call i32 @bar(), !dbg !14
33 br label %for.cond
34 }
35
36 ; CHECK: attributes #[[#BAR_ATTR]] = {{{.*}} "profile-checksum-mismatch" {{.*}}}
37
38 ; Verify the attribute is not merged into the caller.
39 ; MERGE-NOT: attributes #[[#MAIN_ATTR]] = {{{.*}} "profile-checksum-mismatch" {{.*}}}
40
41 attributes #0 = { "use-sample-profile" }
42
43 !llvm.dbg.cu = !{!0}
44 !llvm.module.flags = !{!7}
45 !llvm.pseudo_probe_desc = !{!8, !9, !10}
46
47 !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 19.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !2, splitDebugInlining: false, nameTableKind: None)
48 !1 = !DIFile(filename: "test.c", directory: "/home", checksumkind: CSK_MD5, checksum: "0df0c950a93a603a7d13f0a9d4623642")
49 !2 = !{!3}
50 !3 = !DIGlobalVariableExpression(var: !4, expr: !DIExpression())
51 !4 = distinct !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true)
52 !5 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !6)
53 !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
54 !7 = !{i32 2, !"Debug Info Version", i32 3}
55 !8 = !{i64 7546896869197086323, i64 4294967295, !"baz"}
56 !9 = !{i64 -2012135647395072713, i64 281530612780802, !"bar"}
57 !10 = !{i64 -2624081020897602054, i64 281582081721716, !"main"}
58 !11 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 5, type: !12, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13)
59 !12 = distinct !DISubroutineType(types: !13)
60 !13 = !{}
61 !14 = !DILocation(line: 15, column: 10, scope: !15)
62 !15 = !DILexicalBlockFile(scope: !16, file: !1, discriminator: 186646591)
63 !16 = distinct !DILexicalBlock(scope: !17, file: !1, line: 14, column: 40)
64 !17 = distinct !DILexicalBlock(scope: !18, file: !1, line: 14, column: 3)
65 !18 = distinct !DILexicalBlock(scope: !19, file: !1, line: 14, column: 3)
66 !19 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 12, type: !20, scopeLine: 13, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13)
67 !20 = !DISubroutineType(types: !13)