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

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 27 14:29:13 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)
----------------
aaupov wrote:

Good catch. I don't intend to change the behavior here, will fix.

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


More information about the llvm-branch-commits mailing list