[NFC][IR2Vec] Remove unreachable code and simplify invalid mode test (#146459)
The code following `llvm_unreachable` is optimized out in Release builds. In this case, `Embedder::create` do not seem to return `nullptr` causing `CreateInvalidMode` test to break. Hence removing `llvm_unreachable`.
This commit is contained in:
committed by
GitHub
parent
66cc167dfa
commit
0a69c83421
@@ -129,7 +129,6 @@ std::unique_ptr<Embedder> Embedder::create(IR2VecKind Mode, const Function &F,
|
|||||||
case IR2VecKind::Symbolic:
|
case IR2VecKind::Symbolic:
|
||||||
return std::make_unique<SymbolicEmbedder>(F, Vocabulary);
|
return std::make_unique<SymbolicEmbedder>(F, Vocabulary);
|
||||||
}
|
}
|
||||||
llvm_unreachable("Unknown IR2Vec kind");
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -228,16 +228,9 @@ TEST(IR2VecTest, CreateInvalidMode) {
|
|||||||
FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx), false);
|
FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx), false);
|
||||||
Function *F = Function::Create(FTy, Function::ExternalLinkage, "f", M);
|
Function *F = Function::Create(FTy, Function::ExternalLinkage, "f", M);
|
||||||
|
|
||||||
// static_cast an invalid int to IR2VecKind
|
// static_cast an invalid int to IR2VecKind
|
||||||
#ifndef NDEBUG
|
|
||||||
#if GTEST_HAS_DEATH_TEST
|
|
||||||
EXPECT_DEATH(Embedder::create(static_cast<IR2VecKind>(-1), *F, V),
|
|
||||||
"Unknown IR2Vec kind");
|
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
|
||||||
#else
|
|
||||||
auto Result = Embedder::create(static_cast<IR2VecKind>(-1), *F, V);
|
auto Result = Embedder::create(static_cast<IR2VecKind>(-1), *F, V);
|
||||||
EXPECT_FALSE(static_cast<bool>(Result));
|
EXPECT_FALSE(static_cast<bool>(Result));
|
||||||
#endif // NDEBUG
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(IR2VecTest, LookupVocab) {
|
TEST(IR2VecTest, LookupVocab) {
|
||||||
|
|||||||
Reference in New Issue
Block a user