[llvm-branch-commits] [llvm] [IR2Vec] Refactor vocabulary to use canonical type IDs (PR #155323)

Aiden Grossman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 26 15:42:40 PDT 2025


================
@@ -410,6 +366,21 @@ bool Vocabulary::invalidate(Module &M, const PreservedAnalyses &PA,
   return !(PAC.preservedWhenStateless());
 }
 
+Vocabulary::VocabVector Vocabulary::createDummyVocabForTest(unsigned Dim) {
+  VocabVector DummyVocab;
+  DummyVocab.reserve(NumCanonicalEntries);
+  float DummyVal = 0.1f;
+  // Create a dummy vocabulary with entries for all opcodes, types, and
+  // operands
+  for ([[maybe_unused]] unsigned _ :
----------------
boomanaiden154 wrote:

This is probably easier to write as
```
for (int i = 0; i < Vocabulary::MaxOpcodes + Vocabulary::MaxCanonicalTypeIDs + Vocabulary::MaxOperandKinds; ++i)
```
?

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


More information about the llvm-branch-commits mailing list