[AutoFDO] Reuse profile when tryInlineCandidate() failed?

For example, we have profile as below, and compiler decide function a only inline function b. Now llvm won’t use the profile information about c and d. Finally, there is three function:a(inline b), c, d.

 1: b:xx
  1: c:xx
   1: d:xx

In my opinion, when some profile don’t be used, the profile information should split and merge. When function a inline fuction b and stop use following profile information, the profile information should split as below. Finally, there is tow function:a(inline b),c(inline d).

 1: d:xx

Should we reuse profile when llvm try inlinie failed?

Yes, we do. See llvm-project/SampleProfile.cpp at 47b0758049eab549c51e77c8f8b5560498af5b80 · llvm/llvm-project · GitHub. There’s a switch to control that, i.,e --sample-profile-merge-inlinee whose default value is on.

1 Like