[llvm] [BOLT] fix next-instruction offset in memory-access profile. (PR #208922)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 11 09:15:24 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: David CARLIER (devnexen)

<details>
<summary>Changes</summary>

NextInstrOffset stored the current instruction's own offset instead of the following one. It feeds the RIP-relative jump-table base in memory-profile-guided ICP (IndirectCallPromotion), so the base was short by the access instruction's size.

---
Full diff: https://github.com/llvm/llvm-project/pull/208922.diff


1 Files Affected:

- (modified) bolt/lib/Profile/DataReader.cpp (+1-1) 


``````````diff
diff --git a/bolt/lib/Profile/DataReader.cpp b/bolt/lib/Profile/DataReader.cpp
index 55f4a35b780fd..31a2eb12e5b6e 100644
--- a/bolt/lib/Profile/DataReader.cpp
+++ b/bolt/lib/Profile/DataReader.cpp
@@ -295,7 +295,7 @@ Error DataReader::readProfilePreCFG(BinaryContext &BC) {
       if (NextII == Function.Instructions.end())
         MemAccessProfile.NextInstrOffset = Function.getSize();
       else
-        MemAccessProfile.NextInstrOffset = II->first;
+        MemAccessProfile.NextInstrOffset = NextII->first;
     }
     Function.HasMemoryProfile = true;
   }

``````````

</details>


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


More information about the llvm-commits mailing list