[llvm] [BOLT] Fix the inaccurate profile data check (PR #136278)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 02:03:18 PDT 2025


https://github.com/WangJee updated https://github.com/llvm/llvm-project/pull/136278

>From 33f6b281902751d4ec3ca2e430f823d0393e682d Mon Sep 17 00:00:00 2001
From: wangjue <wangjue at zhcomputing.com>
Date: Fri, 18 Apr 2025 08:15:07 +0000
Subject: [PATCH] [BOLT] Fix the inaccurate profile data check

---
 bolt/lib/Profile/DataReader.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bolt/lib/Profile/DataReader.cpp b/bolt/lib/Profile/DataReader.cpp
index f2e999bbfdc6d..d40ae1ab6d3e9 100644
--- a/bolt/lib/Profile/DataReader.cpp
+++ b/bolt/lib/Profile/DataReader.cpp
@@ -524,6 +524,9 @@ float DataReader::evaluateProfileData(BinaryFunction &BF,
       // when we identify tail calls, so they are still represented
       // by regular branch instructions and we need isBranch() here.
       MCInst *Instr = BF.getInstructionAtOffset(BI.From.Offset);
+      // If it's a RISCV PseudoCALL - fix it
+      if (!Instr && BC.isRISCV())
+        Instr = BF.getInstructionAtOffset(BI.From.Offset + 4);
       // If it's a prefix - skip it.
       if (Instr && BC.MIB->isPrefix(*Instr))
         Instr = BF.getInstructionAtOffset(BI.From.Offset + 1);



More information about the llvm-commits mailing list