[llvm] 418e441 - [InstrProf] Correct buffer size for encodeULEB128 (#67011)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 18:16:06 PDT 2023


Author: Kazushi Marukawa
Date: 2023-09-26T10:16:01+09:00
New Revision: 418e441936d62b847398162ed32399d876f13b59

URL: https://github.com/llvm/llvm-project/commit/418e441936d62b847398162ed32399d876f13b59
DIFF: https://github.com/llvm/llvm-project/commit/418e441936d62b847398162ed32399d876f13b59.diff

LOG: [InstrProf] Correct buffer size for encodeULEB128 (#67011)

This function uses 16 bytes buffer to encode two 64 bits data. However,
the encoding method requires 10 bytes to encode one 64 bits data, so
encoded data actually requiress 20 bytes total.

Added: 
    

Modified: 
    llvm/lib/ProfileData/InstrProf.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index 835dd697bc7b6aa..e82cb5c535f1f5a 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -498,7 +498,7 @@ Error collectPGOFuncNameStrings(ArrayRef<std::string> NameStrs,
                                 bool doCompression, std::string &Result) {
   assert(!NameStrs.empty() && "No name data to emit");
 
-  uint8_t Header[16], *P = Header;
+  uint8_t Header[20], *P = Header;
   std::string UncompressedNameStrings =
       join(NameStrs.begin(), NameStrs.end(), getInstrProfNameSeparator());
 


        


More information about the llvm-commits mailing list