[llvm] [SampleFDO] Stale profile call-graph matching (PR #95135)
Lei Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 17 16:28:26 PDT 2024
================
@@ -189,7 +238,9 @@ LocToLocMap SampleProfileMatcher::longestCommonSequence(
X = V[Index(K - 1)] + 1;
Y = X - K;
while (X < Size1 && Y < Size2 &&
- AnchorList1[X].second == AnchorList2[Y].second)
+ functionMatchesProfile(AnchorList1[X].second,
----------------
wlei-llvm wrote:
Do you mean to run the LCS twice? the first time for the exact name matching, and the second time is for the similarity based fuzzy matching based on the first LCS's unmatched results.
Take an extreme example:
```
IR: New_A. New_B. New_C, D, E
profile: D, E, Unused_A, Unused_B, Unused_C
```
if we want to matched in two LCSs:
The first LCS's result is [D, E] then the unmatched results is
```
IR: New_A. New_B. New_C,
profile: Unused_A, Unused_B, Unused_C
```
and the second LCS result is [A, B, C]. (match. new_XXX. to Unused_XXX)
However, if we apply the matching result,(like we strip the prefix and reran the LCS ), the finial result is actually [A, B, C].
and this is same to the current version, i,e, If we match them together. the LCS is still [A, B, C]
Note that we only match the prefix function to prefix function(New_XXX to Unused_XXX), and match non-prefix to non-prefix function, there is no cross match, cross match is always false here because we check if the profile and function doesn't show in either side.
https://github.com/llvm/llvm-project/pull/95135
More information about the llvm-commits
mailing list