[llvm] Adding Matching and Inference Functionality to Propeller (PR #160706)

Rahman Lavaee via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 11:06:46 PDT 2025


================
@@ -1526,6 +1526,11 @@ void ELFState<ELFT>::writeSectionContent(
         }
         SHeader.sh_size += CBA.writeULEB128(BBE.Size);
         SHeader.sh_size += CBA.writeULEB128(BBE.Metadata);
+        if (FeatureOrErr->BBHash || BBE.Hash.has_value()) {
+          auto Hash = BBE.Hash.has_value() ?
+              BBE.Hash.value() : llvm::yaml::Hex64(0);;
+          SHeader.sh_size += CBA.writeULEB128(Hash);
----------------
rlavaee wrote:

A couple points. 
1. ULEB128 gives you size savings for smaller values (which could fit within a smaller number of bytes), but your random hashes can have their most significant bits set. So there wouldn't be any size savings (and you may even add a single extra byte because of the ULEB encoding).
2. This gets me into thinking whether we actually need 64bit values for the hash. Since we're storing a hash for every basic block, we might be able to use a smaller number of bytes if our inference algorithm is smart-enough. Even with a single byte, collision chance is 1/(2^8) which could be acceptable. We need to remember that this is about performance and a best-effort solution is fine.

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


More information about the llvm-commits mailing list