diff --git a/llvm/unittests/CodeGen/MIR2VecTest.cpp b/llvm/unittests/CodeGen/MIR2VecTest.cpp index 8cd9d5ac9f6be..8710d6b45969a 100644 --- a/llvm/unittests/CodeGen/MIR2VecTest.cpp +++ b/llvm/unittests/CodeGen/MIR2VecTest.cpp @@ -255,6 +255,10 @@ class MIR2VecEmbeddingTestFixture : public MIR2VecVocabTestFixture { void SetUp() override { MIR2VecVocabTestFixture::SetUp(); + // If base class setup was skipped (TII not initialized), skip derived setup + if (!TII) + GTEST_SKIP() << "Failed to get target instruction info in " + "the base class setup; Skipping test"; // Create a dummy function for MachineFunction FunctionType *FT = FunctionType::get(Type::getVoidTy(*Ctx), false);