[llvm] [ProfileData] Fix uint8_t loop index truncating bitmap byte count (PR #220620)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 06:57:10 PDT 2026


https://github.com/ahradwan2-public updated https://github.com/llvm/llvm-project/pull/220620

>From c5323c5124d57c285e5ce7a21f21dff4af69fba0 Mon Sep 17 00:00:00 2001
From: Ahmed Radwan <ahradwan at amd.com>
Date: Mon, 31 Aug 2026 12:49:54 -0400
Subject: [PATCH] [ProfileData] Fix uint8_t loop index truncating bitmap byte
 count

---
 llvm/lib/ProfileData/InstrProfReader.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 8cb107296ba6a..4b97546abc068 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -455,7 +455,7 @@ Error TextInstrProfReader::readNextRecord(NamedInstrProfRecord &Record) {
     if (NumBitmapBytes != 0) {
       // Read each bitmap and fill our internal storage with the values.
       Record.BitmapBytes.reserve(NumBitmapBytes);
-      for (uint8_t I = 0; I < NumBitmapBytes; ++I) {
+      for (uint64_t I = 0; I < NumBitmapBytes; ++I) {
         if (Line.is_at_end())
           return error(instrprof_error::truncated);
         uint8_t BitmapByte;



More information about the llvm-commits mailing list