[llvm] [SampleProfileMatcher] Fix inconsistent anchor matching in stale profile matching (PR #206657)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 5 23:07:18 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 138060 tests passed
* 3524 tests skipped
* 3 tests failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.Transforms/SampleProfile/pseudo-probe-inline.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\opt.exe < C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-inline.ll -passes=pseudo-probe,sample-profile  -sample-profile-file=C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile/Inputs/pseudo-probe-inline.prof -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 -pass-remarks-output=C:\_work\llvm-project\llvm-project\build\test\Transforms\SampleProfile\Output\pseudo-probe-inline.ll.tmp.opt.yaml 2>&1 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-inline.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\opt.exe' -passes=pseudo-probe,sample-profile '-sample-profile-file=C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile/Inputs/pseudo-probe-inline.prof' -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 '-pass-remarks-output=C:\_work\llvm-project\llvm-project\build\test\Transforms\SampleProfile\Output\pseudo-probe-inline.ll.tmp.opt.yaml'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-inline.ll'
# note: command had no output on stdout or stderr
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-inline.ll -check-prefixes=YAML,YAML-NO-ANNOTATE < C:\_work\llvm-project\llvm-project\build\test\Transforms\SampleProfile\Output\pseudo-probe-inline.ll.tmp.opt.yaml
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-inline.ll' -check-prefixes=YAML,YAML-NO-ANNOTATE
# note: command had no output on stdout or stderr
# RUN: at line 4
c:\_work\llvm-project\llvm-project\build\bin\llvm-profdata.exe merge --sample --extbinary C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile/Inputs/pseudo-probe-inline.prof -o C:\_work\llvm-project\llvm-project\build\test\Transforms\SampleProfile\Output\pseudo-probe-inline.ll.tmp2
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-profdata.exe' merge --sample --extbinary 'C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile/Inputs/pseudo-probe-inline.prof' -o 'C:\_work\llvm-project\llvm-project\build\test\Transforms\SampleProfile\Output\pseudo-probe-inline.ll.tmp2'
# note: command had no output on stdout or stderr
# RUN: at line 5
c:\_work\llvm-project\llvm-project\build\bin\opt.exe < C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-inline.ll -passes=pseudo-probe,sample-profile  -sample-profile-file=C:\_work\llvm-project\llvm-project\build\test\Transforms\SampleProfile\Output\pseudo-probe-inline.ll.tmp2 -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 -pass-remarks-output=C:\_work\llvm-project\llvm-project\build\test\Transforms\SampleProfile\Output\pseudo-probe-inline.ll.tmp2.opt.yaml 2>&1 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-inline.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\opt.exe' -passes=pseudo-probe,sample-profile '-sample-profile-file=C:\_work\llvm-project\llvm-project\build\test\Transforms\SampleProfile\Output\pseudo-probe-inline.ll.tmp2' -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 '-pass-remarks-output=C:\_work\llvm-project\llvm-project\build\test\Transforms\SampleProfile\Output\pseudo-probe-inline.ll.tmp2.opt.yaml'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-inline.ll'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-inline.ll:75:10: error: CHECK: expected string not found in input
# | ; CHECK: ![[PD1]] = !{!"branch_weights", i32 5, i32 0}
# |          ^
# | <stdin>:126:59: note: scanning from here
# | !32 = !{i64 6468398850841090686, i64 138828622701, !"zen"}
# |                                                           ^
# | <stdin>:126:59: note: with "PD1" equal to "47"
# | !32 = !{i64 6468398850841090686, i64 138828622701, !"zen"}
# |                                                           ^
# | <stdin>:141:3: note: possible intended match here
# | !47 = !{!"branch_weights", i32 10, i32 0}
# |   ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-inline.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           121: !27 = !{i32 999000, i64 765830, i32 2} 
# |           122: !28 = !{i32 999900, i64 765830, i32 2} 
# |           123: !29 = !{i32 999990, i64 23, i32 7} 
# |           124: !30 = !{i32 999999, i64 23, i32 7} 
# |           125: !31 = !{i64 6699318081062747564, i64 281479271677951, !"foo"} 
# |           126: !32 = !{i64 6468398850841090686, i64 138828622701, !"zen"} 
# | check:75'0                                                              {   search range start (exclusive)
# | check:75'1                                                                  error: no match found in search range
# | check:75'2                                                                  with "PD1" equal to "47"
# |           127: !33 = distinct !DISubprogram(name: "foo", scope: !34, file: !34, line: 9, type: !35, scopeLine: 9, spFlags: DISPFlagDefinition, unit: !38) 
# |           128: !34 = !DIFile(filename: "test.cpp", directory: "test") 
# |           129: !35 = !DISubroutineType(types: !36) 
# |           130: !36 = !{!37, !37} 
# |           131: !37 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 
# |             .
# |             .
# |             .
# |           136: !42 = distinct !DILexicalBlock(scope: !43, file: !34, line: 39, column: 7) 
# |           137: !43 = distinct !DISubprogram(name: "zen", scope: !34, file: !34, line: 37, type: !35, scopeLine: 38, spFlags: DISPFlagDefinition, unit: !38) 
# |           138: !44 = distinct !DILocation(line: 10, column: 11, scope: !45) 
# |           139: !45 = !DILexicalBlockFile(scope: !33, file: !34, discriminator: 455082007) 
# |           140: !46 = !DILocation(line: 39, column: 7, scope: !43, inlinedAt: !44) 
# |           141: !47 = !{!"branch_weights", i32 10, i32 0} 
# | check:75'3       ?                                         possible intended match
# |           142: !48 = !DILocation(line: 41, column: 14, scope: !49, inlinedAt: !44) 
# |           143: !49 = distinct !DILexicalBlock(scope: !42, file: !34, line: 39, column: 14) 
# |           144: !50 = !DILocation(line: 41, column: 5, scope: !49, inlinedAt: !44) 
# |           145: !51 = !{!"branch_weights", i32 765830, i32 10} 
# |           146: !52 = !DILocation(line: 42, column: 16, scope: !53, inlinedAt: !44) 
# |             .
# |             .
# |             .
# |           162: !68 = !DILocation(line: 42, column: 9, scope: !53) 
# |           163: !69 = !DILocation(line: 48, column: 14, scope: !56) 
# |           164: !70 = !DILocation(line: 48, column: 5, scope: !56) 
# |           165: !71 = !DILocation(line: 49, column: 16, scope: !59) 
# |           166: !72 = !DILocation(line: 49, column: 9, scope: !59) 
# |           167: !73 = !DILocation(line: 53, column: 3, scope: !43) 
# | check:75'4                                                        } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.Transforms/SampleProfile/pseudo-probe-stale-profile-renaming.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\opt.exe < C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-stale-profile-renaming.ll -passes=sample-profile -sample-profile-file=C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile/Inputs/pseudo-probe-stale-profile-renaming.prof --salvage-stale-profile --salvage-unused-profile -report-profile-staleness -persist-profile-staleness -S --debug-only=sample-profile,sample-profile-matcher,sample-profile-impl -pass-remarks=inline --min-call-count-for-cg-matching=0 --min-func-count-for-cg-matching=0 --func-profile-similarity-threshold=70 2>&1 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-stale-profile-renaming.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\opt.exe' -passes=sample-profile '-sample-profile-file=C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile/Inputs/pseudo-probe-stale-profile-renaming.prof' --salvage-stale-profile --salvage-unused-profile -report-profile-staleness -persist-profile-staleness -S --debug-only=sample-profile,sample-profile-matcher,sample-profile-impl -pass-remarks=inline --min-call-count-for-cg-matching=0 --min-func-count-for-cg-matching=0 --func-profile-similarity-threshold=70
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-stale-profile-renaming.ll'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-stale-profile-renaming.ll:29:10: error: CHECK: expected string not found in input
# | ; CHECK: (2/3) of functions' profile are matched and (55/81) of samples are reused by call graph matching.
# |          ^
# | <stdin>:25:35: note: scanning from here
# | Run stale profile matching for bar
# |                                   ^
# | <stdin>:27:1: note: possible intended match here
# | (6/3) of functions' profile are matched and (72/81) of samples are reused by call graph matching.
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-stale-profile-renaming.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            20: Callsite with callee:baz is matched from 3 to 3 
# |            21: Callsite with callee:bar is matched from 4 to 4 
# |            22: Run stale profile matching for baz 
# |            23: Function:new_block_only matches profile:block_only 
# |            24: Run stale profile matching for new_block_only 
# |            25: Run stale profile matching for bar 
# | check:29'0                                      {   search range start (exclusive)
# | check:29'1                                          error: no match found in search range
# |            26: (0/3) of functions' profile are invalid and (0/81) of samples are discarded due to function hash mismatch. 
# |            27: (6/3) of functions' profile are matched and (72/81) of samples are reused by call graph matching. 
# | check:29'2     ?                                                                                                   possible intended match
# |            28: (2/5) of callsites' profile are invalid and (55/81) of samples are discarded due to callsite location mismatch. 
# |            29: (0/2) of callsites and (0/55) of samples are recovered by stale profile matching. 
# |            30: Function processing order: 
# |            31: main 
# |            32: test_noninline 
# |             .
# |             .
# |             .
# |           705: !206 = !DILexicalBlockFile(scope: !155, file: !3, discriminator: 186646591) 
# |           706: !207 = !DILocation(line: 35, column: 37, scope: !142) 
# |           707: !208 = !DILocation(line: 35, column: 3, scope: !142) 
# |           708: !209 = distinct !{!209, !144, !210, !211} 
# |           709: !210 = !DILocation(line: 39, column: 3, scope: !135) 
# |           710: !211 = !{!"llvm.loop.mustprogress"} 
# | check:29'3                                         } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.Transforms/SampleProfile/pseudo-probe-stale-profile-toplev-func.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\opt.exe < C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-stale-profile-toplev-func.ll -passes=sample-profile -sample-profile-file=C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile/Inputs/pseudo-probe-stale-profile-toplev-func.prof --salvage-stale-profile --salvage-unused-profile -report-profile-staleness -S --debug-only=sample-profile,sample-profile-matcher,sample-profile-impl -pass-remarks=inline --min-call-count-for-cg-matching=0 --min-func-count-for-cg-matching=0 --load-func-profile-for-cg-matching 2>&1 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-stale-profile-toplev-func.ll -check-prefix=CHECK-TEXT
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\opt.exe' -passes=sample-profile '-sample-profile-file=C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile/Inputs/pseudo-probe-stale-profile-toplev-func.prof' --salvage-stale-profile --salvage-unused-profile -report-profile-staleness -S --debug-only=sample-profile,sample-profile-matcher,sample-profile-impl -pass-remarks=inline --min-call-count-for-cg-matching=0 --min-func-count-for-cg-matching=0 --load-func-profile-for-cg-matching
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-stale-profile-toplev-func.ll' -check-prefix=CHECK-TEXT
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-stale-profile-toplev-func.ll:11:15: error: CHECK-TEXT: expected string not found in input
# | ; CHECK-TEXT: (1/3) of functions' profile are matched and (2724522/3177413) of samples are reused by call graph matching.
# |               ^
# | <stdin>:5:42: note: scanning from here
# | Run stale profile matching for foo_rename
# |                                          ^
# | <stdin>:9:1: note: possible intended match here
# | (2/3) of functions' profile are matched and (3177209/3177413) of samples are reused by call graph matching.
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\Transforms\SampleProfile\pseudo-probe-stale-profile-toplev-func.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: Function foo_rename is not in profile or profile symbol list. 
# |             2: Run stale profile matching for main 
# |             3: The checksums for foo_rename(IR) and foo(Profile) match. 
# |             4: Function:foo_rename matches profile:foo 
# |             5: Run stale profile matching for foo_rename 
# | check:11'0                                             {   search range start (exclusive)
# | check:11'1                                                 error: no match found in search range
# |             6: Function:bar matches profile:bar 
# |             7: Run stale profile matching for bar 
# |             8: (0/3) of functions' profile are invalid and (0/3177413) of samples are discarded due to function hash mismatch. 
# |             9: (2/3) of functions' profile are matched and (3177209/3177413) of samples are reused by call graph matching. 
# | check:11'2     ?                                                                                                             possible intended match
# |            10: (1/1) of callsites' profile are invalid and (51/3177413) of samples are discarded due to callsite location mismatch. 
# |            11: (0/1) of callsites and (0/51) of samples are recovered by stale profile matching. 
# |            12: Function processing order: 
# |            13: main 
# |            14: foo_rename 
# |             .
# |             .
# |             .
# |           231: !93 = !{!"branch_weights", i32 51} 
# |           232: !94 = !DILocation(line: 12, column: 36, scope: !83) 
# |           233: !95 = !DILocation(line: 12, column: 3, scope: !83) 
# |           234: !96 = distinct !{!96, !85, !97, !98} 
# |           235: !97 = !DILocation(line: 14, column: 3, scope: !76) 
# |           236: !98 = !{!"llvm.loop.mustprogress"} 
# | check:11'3                                        } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/206657


More information about the llvm-commits mailing list