[llvm] [profcheck] Add indirect call metadata (PR #154657)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 20 21:04:24 PDT 2025
================
@@ -92,12 +97,21 @@ bool ProfileInjector::inject() {
return false;
bool Changed = false;
for (auto &BB : F) {
- if (AnnotateSelect) {
- for (auto &I : BB) {
- if (isa<SelectInst>(I) && !I.getMetadata(LLVMContext::MD_prof))
- setBranchWeights(I, {SelectTrueWeight, SelectFalseWeight},
- /*IsExpected=*/false);
- }
+ for (auto &I : BB) {
+ // Annotate instructions that support MD_prof metadata, such as `select`
+ // and indirect calls - *if* they don't already have that metadata (i.e.
----------------
mingmingl-llvm wrote:
Thanks for adding this comment to clarify things for me! Now that I have the full context, I think we could shorten it by removing the details that were specific to my initial question. Perhaps we could keep the high-level motivation and remove the finer points inside brackets (_i.e.if the unit test was authored with that metadata, don't replace it_)?
https://github.com/llvm/llvm-project/pull/154657
More information about the llvm-commits
mailing list