[all-commits] [llvm/llvm-project] 9641b9: [Inliner] Preserve !prof metadata when converting ...

Hongtao Yu via All-commits all-commits at lists.llvm.org
Mon May 9 15:08:28 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9641b9be9dfc599cbb6a812c1e587eff2ddd8707
      https://github.com/llvm/llvm-project/commit/9641b9be9dfc599cbb6a812c1e587eff2ddd8707
  Author: Hongtao Yu <hoy at fb.com>
  Date:   2022-05-09 (Mon, 09 May 2022)

  Changed paths:
    M llvm/lib/Transforms/Utils/Local.cpp
    A llvm/test/Transforms/Inline/profile_meta_invoke.ll

  Log Message:
  -----------
  [Inliner] Preserve !prof metadata when converting call to invoke.

When a callee function is inlined via an invoke instruction, every function call inside the callee, if not an invoke,  will be converted to an invoke after cloned to the caller body. I found that during the conversion the !prof metadata was dropped. This in turned caused a cloned indirect call not properly promoted in subsequent passes.

The particular scenario I was investigating was with AutoFDO and thinLTO. In prelink, no ICP was triggered (neither by the sample loader nor PGO ICP), no indirect call was promoted. This is because 1) the particular indirect call did not have inlined samples;  and 2) PGO ICP was intentionally disabled.  After inlining, the prof metadata was dropped. Then in postlink, PGO ICP jumped in but didn't do anything. Thus the opportunity was missed.

I'm making a simple fix to preserve !prof metadata when converting call to invoke.

Reviewed By: davidxl

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




More information about the All-commits mailing list