Skip to content

Conversation

svkeerthy
Copy link
Contributor

Fixes the warning default label in switch which covers all enumeration values [-Wcovered-switch-default]

@llvmbot llvmbot added mlgo llvm:analysis Includes value tracking, cost tables and constant folding labels Aug 28, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 28, 2025

@llvm/pr-subscribers-llvm-analysis

Author: S. VenkataKeerthy (svkeerthy)

Changes

Fixes the warning default label in switch which covers all enumeration values [-Wcovered-switch-default]


Full diff: https://github.com/llvm/llvm-project/pull/155917.diff

1 Files Affected:

  • (modified) llvm/lib/Analysis/IR2Vec.cpp (+1-11)
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;

@llvmbot
Copy link
Member

llvmbot commented Aug 28, 2025

@llvm/pr-subscribers-mlgo

Author: S. VenkataKeerthy (svkeerthy)

Changes

Fixes the warning default label in switch which covers all enumeration values [-Wcovered-switch-default]


Full diff: https://github.com/llvm/llvm-project/pull/155917.diff

1 Files Affected:

  • (modified) llvm/lib/Analysis/IR2Vec.cpp (+1-11)
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;

@svkeerthy svkeerthy changed the title Fix warning in IR2Vec [NFC] Fix warning in IR2Vec Embedder creation in printer pass Aug 28, 2025
@svkeerthy svkeerthy requested a review from farzonl August 28, 2025 20:37
@svkeerthy svkeerthy enabled auto-merge (squash) August 28, 2025 22:24
@svkeerthy svkeerthy disabled auto-merge August 28, 2025 22:25
@svkeerthy svkeerthy merged commit cdf5f47 into main Aug 28, 2025
5 of 9 checks passed
@svkeerthy svkeerthy deleted the users/svkeerthy/08-28-warning-fix branch August 28, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:analysis Includes value tracking, cost tables and constant folding mlgo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants