[all-commits] [llvm/llvm-project] 1ae179: [SampleProfileMatcher] Fix backward matching of no...

Wei Wang via All-commits all-commits at lists.llvm.org
Mon Apr 6 15:21:54 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1ae179b3257b1087a0b0e354d5dbc7afd8ddd0e6
      https://github.com/llvm/llvm-project/commit/1ae179b3257b1087a0b0e354d5dbc7afd8ddd0e6
  Author: Wei Wang <apollo.mobility at gmail.com>
  Date:   2026-04-06 (Mon, 06 Apr 2026)

  Changed paths:
    M llvm/lib/Transforms/IPO/SampleProfileMatcher.cpp
    A llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-stale-profile-backward-matching.prof
    A llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-backward-matching.ll

  Log Message:
  -----------
  [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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list