[PATCH] D102537: [CSSPGO] Overwrite branch weight annotated in previous pass.

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 13:27:44 PDT 2021


wmi accepted this revision.
wmi added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: llvm/lib/Transforms/IPO/SampleProfile.cpp:1497-1499
+      for (auto &I : BB->getInstList())
+        if (isa<CallInst>(I) || isa<InvokeInst>(I))
+          I.setMetadata(LLVMContext::MD_prof, nullptr);
----------------
hoy wrote:
> wmi wrote:
> > Remove MD_prof means compiler may use static heuristic to infer the callsite hotness, which can still be hot. This is different from marking it as cold. 
> > 
> > If the profile is accurate, why not set the count to 0?
> I see. Thanks for pointing it out. We want it to be treated as cold here. Should be using zero count for direct callsites. For indirect callsites, I'm inclined to removing the metadata which shouldn't trigger PGO ICP to do anything. What do you think?
Removing metadata for indirect callsites makes sense to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102537



More information about the llvm-commits mailing list