[all-commits] [llvm/llvm-project] ced3b9: [MemProf] Change map to vector to avoid unstable i...

Teresa Johnson via All-commits all-commits at lists.llvm.org
Mon Jul 28 14:21:11 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ced3b90738ff6a4c2f5f264e5085477dc59ffcf8
      https://github.com/llvm/llvm-project/commit/ced3b90738ff6a4c2f5f264e5085477dc59ffcf8
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2025-07-28 (Mon, 28 Jul 2025)

  Changed paths:
    M llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

  Log Message:
  -----------
  [MemProf] Change map to vector to avoid unstable iteration (#151039)

We iterate over a std::map indexed by FuncInfo, which is a pair of a
pointer and a clone number. In the ThinLTO case, this isn't an issue as
the function pointer always points to the same FunctionSummary object.
However, for regular LTO, this is a pointer to a Function object, which
is different for each clone. This will lead to unstable iteration order.

This was exposed in a test case added for PR150735, which added a new
instance of iteration over this map.

Since these function clones are added and numbered sequentially, change
this to a vector indexed by clone number, which points to a structure
containing the clone FuncInfo and the call map (the old map's key and
value, respectively).



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