[llvm-branch-commits] [llvm] [IR2Vec] Refactor vocabulary to use section-based storage (PR #158376)

Mircea Trofin via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Sep 17 07:23:25 PDT 2025


================
@@ -144,6 +145,73 @@ struct Embedding {
 using InstEmbeddingsMap = DenseMap<const Instruction *, Embedding>;
 using BBEmbeddingsMap = DenseMap<const BasicBlock *, Embedding>;
 
+/// Generic storage class for section-based vocabularies.
+/// VocabStorage provides a generic foundation for storing and accessing
+/// embeddings organized into sections.
+class VocabStorage {
+private:
+  /// Section-based storage
+  std::vector<std::vector<Embedding>> Sections;
+
+  const size_t TotalSize = 0;
----------------
mtrofin wrote:

you don't need to init at decl if it's const, in fact, some compilers will complain. It'll be a compiletime error not to initialize.

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


More information about the llvm-branch-commits mailing list