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

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 21:21:09 PDT 2023


davidxl added a comment.

In D147954#4276299 <https://reviews.llvm.org/D147954#4276299>, @wenlei wrote:

> 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.

This one is mainly for profile based devirtualization. Related to inlining, there is a pre-pass to do the unmerging:

arg = select cond, 1, val
call foo(arg)

>
-

if (cond) {

  call foo(1)

} else

  call foo(val)


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

https://reviews.llvm.org/D147954



More information about the llvm-commits mailing list