[all-commits] [llvm/llvm-project] 4b493e: [ProfileData] Add getValueArrayForSite (#95335)

Kazu Hirata via All-commits all-commits at lists.llvm.org
Thu Jun 13 11:08:39 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4b493e31b2c5d72d993f0e914adb711f3ce4ba05
      https://github.com/llvm/llvm-project/commit/4b493e31b2c5d72d993f0e914adb711f3ce4ba05
  Author: Kazu Hirata <kazu at google.com>
  Date:   2024-06-13 (Thu, 13 Jun 2024)

  Changed paths:
    M llvm/include/llvm/ProfileData/InstrProf.h
    M llvm/unittests/ProfileData/InstrProfTest.cpp

  Log Message:
  -----------
  [ProfileData] Add getValueArrayForSite (#95335)

Without this patch, a typical traversal over the value data looks
like:

  uint32_t NV = Func.getNumValueDataForSite(VK, S);
std::unique_ptr<InstrProfValueData[]> VD = Func.getValueForSite(VK, S);
  for (uint32_t V = 0; V < NV; V++)
    Do something with VD[V].Value and/or VD[V].Count;

This patch adds getValueArrayForSite, which returns
ArrayRef<InstrProfValueData>, so we can do:

  for (const auto &V : Func.getValueArrayForSite(VK, S))
    Do something with V.Value and/or V.Count;

I'm planning to migrate the existing uses of getValueForSite to
getValueArrayForSite in follow-up patches and remove getValueForSite
and getNumValueDataForSite.



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