[all-commits] [llvm/llvm-project] 4c2b57: [llvm-profgen] Fixing a context attribure update i...

Hongtao Yu via All-commits all-commits at lists.llvm.org
Thu Mar 31 17:34:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4c2b57ae48cd333d7dac3f6e5fc1d5e900bfa902
      https://github.com/llvm/llvm-project/commit/4c2b57ae48cd333d7dac3f6e5fc1d5e900bfa902
  Author: Hongtao Yu <hoy at fb.com>
  Date:   2022-03-31 (Thu, 31 Mar 2022)

  Changed paths:
    M llvm/tools/llvm-profgen/ProfileGenerator.cpp

  Log Message:
  -----------
  [llvm-profgen] Fixing a context attribure update issue due to a non-derministic processing order on different platforms.

 A context can  be created by invoking the `getFunctionProfileForContext` function in two ways:
      - by using a probe and its calling context.
      - by removing the leaf frame from an existing contexts. The first way is used when generating a function profile for a given LBR range, and the input `WasLeafInlined` is computed depending on the actually probe in the LBR range. The second way is used when using the entry count of an inlinee function profile to update its inliner callsite count, so `WasLeafInlined` is unknown for the inliner frame.

The two  invocations can happen in different order on different platforms, since the lbr ranges are stored in an unordered_map, and  we are making sure `ContextWasInlined` is always set correctly.

This should fix the random test failure introduced by D121655

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D122844




More information about the All-commits mailing list