[llvm] [NFC] Fix warning in IR2Vec Embedder creation in printer pass (PR #155917)

S. VenkataKeerthy via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 15:25:06 PDT 2025


https://github.com/svkeerthy updated https://github.com/llvm/llvm-project/pull/155917

>From 19cd3d9d4c1f7f5e59096ac6a2d7ac5bb3070cfa Mon Sep 17 00:00:00 2001
From: svkeerthy <venkatakeerthy at google.com>
Date: Thu, 28 Aug 2025 20:35:13 +0000
Subject: [PATCH] Fix warning in IR2Vec

---
 llvm/lib/Analysis/IR2Vec.cpp | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/llvm/lib/Analysis/IR2Vec.cpp b/llvm/lib/Analysis/IR2Vec.cpp
index 7d0ad6a69a398..af6242d72e1c9 100644
--- a/llvm/lib/Analysis/IR2Vec.cpp
+++ b/llvm/lib/Analysis/IR2Vec.cpp
@@ -601,17 +601,7 @@ PreservedAnalyses IR2VecPrinterPass::run(Module &M,
   assert(Vocabulary.isValid() && "IR2Vec Vocabulary is invalid");
 
   for (Function &F : M) {
-    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:
-      llvm_unreachable("Unknown IR2Vec embedding kind");
-    }
+    auto Emb = Embedder::create(IR2VecEmbeddingKind, F, Vocabulary);
     if (!Emb) {
       OS << "Error creating IR2Vec embeddings \n";
       continue;



More information about the llvm-commits mailing list