[llvm] [IR2Vec] Restructuring Vocabulary (PR #145119)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 12:21:18 PDT 2025


================
@@ -251,33 +208,165 @@ void SymbolicEmbedder::computeEmbeddings() const {
 }
 
 // ==----------------------------------------------------------------------===//
-// IR2VecVocabResult and IR2VecVocabAnalysis
+// Vocabulary
 //===----------------------------------------------------------------------===//
 
-IR2VecVocabResult::IR2VecVocabResult(ir2vec::Vocab &&Vocabulary)
-    : Vocabulary(std::move(Vocabulary)), Valid(true) {}
+Vocabulary::Vocabulary(VocabVector &&Vocab)
+    : Vocab(std::move(Vocab)), Valid(true) {}
 
-const ir2vec::Vocab &IR2VecVocabResult::getVocabulary() const {
+bool Vocabulary::isValid() const {
+  return Vocab.size() == MaxOpcodes + MaxTypes + MaxOperandKinds && Valid;
----------------
mtrofin wrote:

put the addition in brackets to rely less on operator precedence (it's easier for the reader)

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


More information about the llvm-commits mailing list