[PATCH] D147954: [SimplifyCFG]Prevent premature simplification of callsites with profile data

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 18:38:31 PDT 2023


wenlei added a comment.

I guess you do this only for calls and limit it for pre-link because you want to minimize the restriction on optimization, while making post-link inlining operate on accurate call profile?

Code motion is generally destructive for profile quality. Instead of blocking all sinking and hoisting, have you considered trying to update profile for sinking/hoisting when there's no merging, but only block those that involves merging (i.e. head/tail merge) with incompatible profile? I imagine in some cases, allow sinking/hoisting but updating profile properly may help better inlining later.



================
Comment at: llvm/test/Transforms/SimplifyCFG/preserve-call-metadata-in-hoist.ll:8
+; Without preserving call instructions, `d->func1` is hoisted while it may not make sense
+; to do so. For example, the candidate calls are different based on derived type.
+; class Base {
----------------
davidxl wrote:
> Perhaps add "merging meta data will make the profile data less precise and not desirable either".
 would be good to mention it in code comment and change description as well. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147954/new/

https://reviews.llvm.org/D147954



More information about the llvm-commits mailing list