[llvm] [IR2Vec] Add support for flow-aware embeddings (PR #152613)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 13:08:43 PDT 2025


================
@@ -552,8 +601,17 @@ PreservedAnalyses IR2VecPrinterPass::run(Module &M,
   assert(Vocabulary.isValid() && "IR2Vec Vocabulary is invalid");
 
   for (Function &F : M) {
-    std::unique_ptr<Embedder> Emb =
-        Embedder::create(IR2VecKind::Symbolic, F, Vocabulary);
+    std::unique_ptr<Embedder> Emb;
+    switch (IR2VecEmbeddingKind) {
+    case IR2VecKind::Symbolic:
+      Emb = std::make_unique<SymbolicEmbedder>(F, Vocabulary);
+      break;
+    case IR2VecKind::FlowAware:
+      Emb = std::make_unique<FlowAwareEmbedder>(F, Vocabulary);
+      break;
+    default:
----------------
farzonl wrote:

This change has introduced warnings into main. Can you please fix this: 
```
llvm-project/llvm/lib/Analysis/IR2Vec.cpp:612:5: warning: default label in switch which covers all enumeration values [-Wcovered-switch-default]
  612 |     default:
```

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


More information about the llvm-commits mailing list