llvm-project
1ae179b3 - [SampleProfileMatcher] Fix backward matching of non-anchor locations (#190118)

Commit
1 day ago
[SampleProfileMatcher] Fix backward matching of non-anchor locations (#190118) The backward matching loop in `matchNonCallsiteLocs` was ineffective because `InsertMatching` used `std::unordered_map::insert()` which does not overwrite existing entries. Since forward matching already inserted entries for all non-anchor locations, the backward matching for the second half was silently ignored. The backward matching can update forward mappings in `IRToProfileLocationMap` in 2 ways: - The IR location maps a new different profile location. Change `insert()` to `insert_or_assign()` so that entry overwrite can happen. - The IR location maps the same profile location. Add `erase()` to remove such mapping.
Author
Parents
Loading