[PATCH] D133121: [PGO] Annotate branch_weight for invoke instruction

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 13:28:04 PDT 2022


hoy added a comment.

Thanks for the change. Wondering if you saw performance improvement with it.

The corresponding change on the sample profile side isn't included, do you have any plan for it?



================
Comment at: llvm/lib/ProfileData/InstrProf.cpp:1077
+  InvokeVals.push_back(MDNode::get(Ctx, Vals));
+  MDNode *NewM = MDNode::getDistinct(Ctx, InvokeVals);
+  NewM->replaceOperandWith(0, NewM);
----------------
Can we use `get` instead of  `getDistinct` so that  invokes with same metadata can potentially share the same node?


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:2168
+  ProfileData = InvokeInst::getIndirectCallProfData(ProfileData);
+  if (!ProfileData) {
+    uint64_t TotalWeight;
----------------
Should the check be `if (ProfileData)`?  If the original invoke doesn't have !VP, the new call should end up with no metadata based on the existing behavior.


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

https://reviews.llvm.org/D133121



More information about the llvm-commits mailing list