[llvm-branch-commits] [llvm] [BOLT] Set EntryDiscriminator in YAML profile for indirect calls (PR #82128)

Maksim Panchenko via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 27 12:45:53 PDT 2024


================
@@ -78,32 +97,15 @@ YAMLProfileWriter::convert(const BinaryFunction &BF, bool UseDFS) {
         if (!ICSP)
           continue;
         for (const IndirectCallProfile &CSP : ICSP.get()) {
-          StringRef TargetName = "";
-          CSI.DestId = 0; // designated for unknown functions
-          CSI.EntryDiscriminator = 0;
-          if (CSP.Symbol) {
-            const BinaryFunction *Callee = BC.getFunctionForSymbol(CSP.Symbol);
-            if (Callee) {
-              CSI.DestId = Callee->getFunctionNumber();
-              TargetName = Callee->getOneName();
-            }
-          }
+          const BinaryFunction *Callee = setCSIDestination(BC, CSI, CSP.Symbol);
           CSI.Count = CSP.Count;
           CSI.Mispreds = CSP.Mispreds;
-          CSTargets.emplace_back(TargetName, CSI);
+          if (CSI.Count && Callee)
----------------
maksfb wrote:

Previously, we would record data for unknown destinations, but now we are ignoring those. Not sure if it matters in practice. But if we are going to ignore them, the code that could be simplified/refactored.

https://github.com/llvm/llvm-project/pull/82128


More information about the llvm-branch-commits mailing list