From 5bbf1feab5a40337ae8288eb9c9d8d37103c463e Mon Sep 17 00:00:00 2001 From: Igor Kudrin Date: Fri, 21 May 2021 10:31:56 +0700 Subject: [PATCH] [unittests][CodeGen] Mark tests that cannot be executed with GTEST_SKIP() This helps to distinguish such tests from successfully passed ones. Differential Revision: https://reviews.llvm.org/D102754 --- .../CodeGen/AArch64SelectionDAGTest.cpp | 77 +------------------ .../unittests/CodeGen/AsmPrinterDwarfTest.cpp | 42 +++++----- llvm/unittests/CodeGen/DIEHashTest.cpp | 3 +- llvm/unittests/CodeGen/DIETest.cpp | 23 +----- llvm/unittests/CodeGen/PassManagerTest.cpp | 2 +- .../SelectionDAGAddressAnalysisTest.cpp | 18 +---- llvm/unittests/CodeGen/TargetOptionsTest.cpp | 2 +- 7 files changed, 30 insertions(+), 137 deletions(-) diff --git a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp index f7543d8ded8a..0024d8368738 100644 --- a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp +++ b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp @@ -37,14 +37,14 @@ protected: // initialize a target. A skeleton Target for unittests would allow us to // always run these tests. if (!T) - return; + GTEST_SKIP(); TargetOptions Options; TM = std::unique_ptr(static_cast( T->createTargetMachine("AArch64", "", "+sve", Options, None, None, CodeGenOpt::Aggressive))); if (!TM) - return; + GTEST_SKIP(); SMDiagnostic SMError; M = parseAssemblyString(Assembly, SMError, Context); @@ -85,8 +85,6 @@ protected: }; TEST_F(AArch64SelectionDAGTest, computeKnownBits_ZERO_EXTEND_VECTOR_INREG) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); auto Int16VT = EVT::getIntegerVT(Context, 16); @@ -100,8 +98,6 @@ TEST_F(AArch64SelectionDAGTest, computeKnownBits_ZERO_EXTEND_VECTOR_INREG) { } TEST_F(AArch64SelectionDAGTest, computeKnownBitsSVE_ZERO_EXTEND_VECTOR_INREG) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); auto Int16VT = EVT::getIntegerVT(Context, 16); @@ -119,8 +115,6 @@ TEST_F(AArch64SelectionDAGTest, computeKnownBitsSVE_ZERO_EXTEND_VECTOR_INREG) { } TEST_F(AArch64SelectionDAGTest, computeKnownBits_EXTRACT_SUBVECTOR) { - if (!TM) - return; SDLoc Loc; auto IntVT = EVT::getIntegerVT(Context, 8); auto VecVT = EVT::getVectorVT(Context, IntVT, 3); @@ -134,8 +128,6 @@ TEST_F(AArch64SelectionDAGTest, computeKnownBits_EXTRACT_SUBVECTOR) { } TEST_F(AArch64SelectionDAGTest, ComputeNumSignBits_SIGN_EXTEND_VECTOR_INREG) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); auto Int16VT = EVT::getIntegerVT(Context, 16); @@ -148,8 +140,6 @@ TEST_F(AArch64SelectionDAGTest, ComputeNumSignBits_SIGN_EXTEND_VECTOR_INREG) { } TEST_F(AArch64SelectionDAGTest, ComputeNumSignBitsSVE_SIGN_EXTEND_VECTOR_INREG) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); auto Int16VT = EVT::getIntegerVT(Context, 16); @@ -162,8 +152,6 @@ TEST_F(AArch64SelectionDAGTest, ComputeNumSignBitsSVE_SIGN_EXTEND_VECTOR_INREG) } TEST_F(AArch64SelectionDAGTest, ComputeNumSignBits_EXTRACT_SUBVECTOR) { - if (!TM) - return; SDLoc Loc; auto IntVT = EVT::getIntegerVT(Context, 8); auto VecVT = EVT::getVectorVT(Context, IntVT, 3); @@ -176,9 +164,6 @@ TEST_F(AArch64SelectionDAGTest, ComputeNumSignBits_EXTRACT_SUBVECTOR) { } TEST_F(AArch64SelectionDAGTest, SimplifyDemandedVectorElts_EXTRACT_SUBVECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -198,9 +183,6 @@ TEST_F(AArch64SelectionDAGTest, SimplifyDemandedVectorElts_EXTRACT_SUBVECTOR) { } TEST_F(AArch64SelectionDAGTest, SimplifyDemandedBitsNEON) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -227,9 +209,6 @@ TEST_F(AArch64SelectionDAGTest, SimplifyDemandedBitsNEON) { } TEST_F(AArch64SelectionDAGTest, SimplifyDemandedBitsSVE) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -254,8 +233,6 @@ TEST_F(AArch64SelectionDAGTest, SimplifyDemandedBitsSVE) { // Piggy-backing on the AArch64 tests to verify SelectionDAG::computeKnownBits. TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_ADD) { - if (!TM) - return; SDLoc Loc; auto IntVT = EVT::getIntegerVT(Context, 8); auto UnknownOp = DAG->getRegister(0, IntVT); @@ -275,8 +252,6 @@ TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_ADD) { // Piggy-backing on the AArch64 tests to verify SelectionDAG::computeKnownBits. TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_SUB) { - if (!TM) - return; SDLoc Loc; auto IntVT = EVT::getIntegerVT(Context, 8); auto N0 = DAG->getConstant(0x55, Loc, IntVT); @@ -295,9 +270,6 @@ TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_SUB) { } TEST_F(AArch64SelectionDAGTest, isSplatValue_Fixed_BUILD_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -318,9 +290,6 @@ TEST_F(AArch64SelectionDAGTest, isSplatValue_Fixed_BUILD_VECTOR) { } TEST_F(AArch64SelectionDAGTest, isSplatValue_Fixed_ADD_of_BUILD_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -345,9 +314,6 @@ TEST_F(AArch64SelectionDAGTest, isSplatValue_Fixed_ADD_of_BUILD_VECTOR) { } TEST_F(AArch64SelectionDAGTest, isSplatValue_Scalable_SPLAT_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -368,9 +334,6 @@ TEST_F(AArch64SelectionDAGTest, isSplatValue_Scalable_SPLAT_VECTOR) { } TEST_F(AArch64SelectionDAGTest, isSplatValue_Scalable_ADD_of_SPLAT_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -395,9 +358,6 @@ TEST_F(AArch64SelectionDAGTest, isSplatValue_Scalable_ADD_of_SPLAT_VECTOR) { } TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Fixed_BUILD_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -413,9 +373,6 @@ TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Fixed_BUILD_VECTOR) { } TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Fixed_ADD_of_BUILD_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -434,9 +391,6 @@ TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Fixed_ADD_of_BUILD_VECTOR) } TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Scalable_SPLAT_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -452,9 +406,6 @@ TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Scalable_SPLAT_VECTOR) { } TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Scalable_ADD_of_SPLAT_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -473,9 +424,6 @@ TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Scalable_ADD_of_SPLAT_VECTO } TEST_F(AArch64SelectionDAGTest, getRepeatedSequence_Patterns) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -594,45 +542,30 @@ TEST_F(AArch64SelectionDAGTest, getRepeatedSequence_Patterns) { } TEST_F(AArch64SelectionDAGTest, getTypeConversion_SplitScalableMVT) { - if (!TM) - return; - MVT VT = MVT::nxv4i64; EXPECT_EQ(getTypeAction(VT), TargetLoweringBase::TypeSplitVector); ASSERT_TRUE(getTypeToTransformTo(VT).isScalableVector()); } TEST_F(AArch64SelectionDAGTest, getTypeConversion_PromoteScalableMVT) { - if (!TM) - return; - MVT VT = MVT::nxv2i32; EXPECT_EQ(getTypeAction(VT), TargetLoweringBase::TypePromoteInteger); ASSERT_TRUE(getTypeToTransformTo(VT).isScalableVector()); } TEST_F(AArch64SelectionDAGTest, getTypeConversion_NoScalarizeMVT_nxv1f32) { - if (!TM) - return; - MVT VT = MVT::nxv1f32; EXPECT_NE(getTypeAction(VT), TargetLoweringBase::TypeScalarizeVector); ASSERT_TRUE(getTypeToTransformTo(VT).isScalableVector()); } TEST_F(AArch64SelectionDAGTest, getTypeConversion_SplitScalableEVT) { - if (!TM) - return; - EVT VT = EVT::getVectorVT(Context, MVT::i64, 256, true); EXPECT_EQ(getTypeAction(VT), TargetLoweringBase::TypeSplitVector); EXPECT_EQ(getTypeToTransformTo(VT), VT.getHalfNumVectorElementsVT(Context)); } TEST_F(AArch64SelectionDAGTest, getTypeConversion_WidenScalableEVT) { - if (!TM) - return; - EVT FromVT = EVT::getVectorVT(Context, MVT::i64, 6, true); EVT ToVT = EVT::getVectorVT(Context, MVT::i64, 8, true); @@ -641,17 +574,11 @@ TEST_F(AArch64SelectionDAGTest, getTypeConversion_WidenScalableEVT) { } TEST_F(AArch64SelectionDAGTest, getTypeConversion_NoScalarizeEVT_nxv1f128) { - if (!TM) - return; - EVT FromVT = EVT::getVectorVT(Context, MVT::f128, 1, true); EXPECT_DEATH(getTypeAction(FromVT), "Cannot legalize this vector"); } TEST_F(AArch64SelectionDAGTest, TestFold_STEP_VECTOR) { - if (!TM) - return; - SDLoc Loc; auto IntVT = EVT::getIntegerVT(Context, 8); auto VecVT = EVT::getVectorVT(Context, MVT::i8, 16, true); diff --git a/llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp b/llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp index d50a817b7b83..8d2d1fe9fe82 100644 --- a/llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp +++ b/llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp @@ -70,7 +70,7 @@ protected: TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, COFF) { if (!init("x86_64-pc-windows", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); EXPECT_CALL(TestPrinter->getMS(), EmitCOFFSecRel32(Val, 0)); TestPrinter->getAP()->emitDwarfSymbolReference(Val, false); @@ -78,7 +78,7 @@ TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, COFF) { TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, COFFForceOffset) { if (!init("x86_64-pc-windows", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); EXPECT_CALL(TestPrinter->getMS(), emitAbsoluteSymbolDiff(Val, SecBeginSymbol, 4)); @@ -87,7 +87,7 @@ TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, COFFForceOffset) { TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, ELFDWARF32) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); const MCExpr *Arg0 = nullptr; EXPECT_CALL(TestPrinter->getMS(), emitValueImpl(_, 4, _)) @@ -101,7 +101,7 @@ TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, ELFDWARF32) { TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, ELFDWARF32ForceOffset) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); EXPECT_CALL(TestPrinter->getMS(), emitAbsoluteSymbolDiff(Val, SecBeginSymbol, 4)); @@ -110,7 +110,7 @@ TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, ELFDWARF32ForceOffset) { TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, ELFDWARF64) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF64)) - return; + GTEST_SKIP(); const MCExpr *Arg0 = nullptr; EXPECT_CALL(TestPrinter->getMS(), emitValueImpl(_, 8, _)) @@ -124,7 +124,7 @@ TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, ELFDWARF64) { TEST_F(AsmPrinterEmitDwarfSymbolReferenceTest, ELFDWARF64ForceOffset) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF64)) - return; + GTEST_SKIP(); EXPECT_CALL(TestPrinter->getMS(), emitAbsoluteSymbolDiff(Val, SecBeginSymbol, 8)); @@ -149,7 +149,7 @@ protected: TEST_F(AsmPrinterEmitDwarfStringOffsetTest, DWARF32) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); const MCExpr *Arg0 = nullptr; EXPECT_CALL(TestPrinter->getMS(), emitValueImpl(_, 4, _)) @@ -164,7 +164,7 @@ TEST_F(AsmPrinterEmitDwarfStringOffsetTest, DWARF32) { TEST_F(AsmPrinterEmitDwarfStringOffsetTest, DWARF32NoRelocationsAcrossSections) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); TestPrinter->setDwarfUsesRelocationsAcrossSections(false); EXPECT_CALL(TestPrinter->getMS(), emitIntValue(Val.Offset, 4)); @@ -173,7 +173,7 @@ TEST_F(AsmPrinterEmitDwarfStringOffsetTest, TEST_F(AsmPrinterEmitDwarfStringOffsetTest, DWARF64) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF64)) - return; + GTEST_SKIP(); const MCExpr *Arg0 = nullptr; EXPECT_CALL(TestPrinter->getMS(), emitValueImpl(_, 8, _)) @@ -188,7 +188,7 @@ TEST_F(AsmPrinterEmitDwarfStringOffsetTest, DWARF64) { TEST_F(AsmPrinterEmitDwarfStringOffsetTest, DWARF64NoRelocationsAcrossSections) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF64)) - return; + GTEST_SKIP(); TestPrinter->setDwarfUsesRelocationsAcrossSections(false); EXPECT_CALL(TestPrinter->getMS(), emitIntValue(Val.Offset, 8)); @@ -212,7 +212,7 @@ protected: TEST_F(AsmPrinterEmitDwarfOffsetTest, DWARF32) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); const MCExpr *Arg0 = nullptr; EXPECT_CALL(TestPrinter->getMS(), emitValueImpl(_, 4, _)) @@ -236,7 +236,7 @@ TEST_F(AsmPrinterEmitDwarfOffsetTest, DWARF32) { TEST_F(AsmPrinterEmitDwarfOffsetTest, DWARF64) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF64)) - return; + GTEST_SKIP(); const MCExpr *Arg0 = nullptr; EXPECT_CALL(TestPrinter->getMS(), emitValueImpl(_, 8, _)) @@ -265,7 +265,7 @@ protected: TEST_F(AsmPrinterEmitDwarfLengthOrOffsetTest, DWARF32) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); EXPECT_CALL(TestPrinter->getMS(), emitIntValue(Val, 4)); TestPrinter->getAP()->emitDwarfLengthOrOffset(Val); @@ -273,7 +273,7 @@ TEST_F(AsmPrinterEmitDwarfLengthOrOffsetTest, DWARF32) { TEST_F(AsmPrinterEmitDwarfLengthOrOffsetTest, DWARF64) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF64)) - return; + GTEST_SKIP(); EXPECT_CALL(TestPrinter->getMS(), emitIntValue(Val, 8)); TestPrinter->getAP()->emitDwarfLengthOrOffset(Val); @@ -284,14 +284,14 @@ class AsmPrinterGetUnitLengthFieldByteSizeTest : public AsmPrinterFixtureBase { TEST_F(AsmPrinterGetUnitLengthFieldByteSizeTest, DWARF32) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); EXPECT_EQ(TestPrinter->getAP()->getUnitLengthFieldByteSize(), 4u); } TEST_F(AsmPrinterGetUnitLengthFieldByteSizeTest, DWARF64) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF64)) - return; + GTEST_SKIP(); EXPECT_EQ(TestPrinter->getAP()->getUnitLengthFieldByteSize(), 12u); } @@ -303,7 +303,7 @@ protected: TEST_F(AsmPrinterEmitDwarfUnitLengthAsIntTest, DWARF32) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); EXPECT_CALL(TestPrinter->getMS(), emitIntValue(Val, 4)); TestPrinter->getAP()->emitDwarfUnitLength(Val, ""); @@ -311,7 +311,7 @@ TEST_F(AsmPrinterEmitDwarfUnitLengthAsIntTest, DWARF32) { TEST_F(AsmPrinterEmitDwarfUnitLengthAsIntTest, DWARF64) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF64)) - return; + GTEST_SKIP(); InSequence S; EXPECT_CALL(TestPrinter->getMS(), emitIntValue(dwarf::DW_LENGTH_DWARF64, 4)); @@ -334,7 +334,7 @@ protected: TEST_F(AsmPrinterEmitDwarfUnitLengthAsHiLoDiffTest, DWARF32) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); InSequence S; const MCSymbol *Hi = nullptr; @@ -354,7 +354,7 @@ TEST_F(AsmPrinterEmitDwarfUnitLengthAsHiLoDiffTest, DWARF32) { TEST_F(AsmPrinterEmitDwarfUnitLengthAsHiLoDiffTest, DWARF64) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF64)) - return; + GTEST_SKIP(); InSequence S; const MCSymbol *Hi = nullptr; @@ -421,7 +421,7 @@ protected: TEST_F(AsmPrinterHandlerTest, Basic) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF32)) - return; + GTEST_SKIP(); ASSERT_EQ(BeginCount, 3); ASSERT_EQ(EndCount, 3); diff --git a/llvm/unittests/CodeGen/DIEHashTest.cpp b/llvm/unittests/CodeGen/DIEHashTest.cpp index 03bb7de5a0ae..b6dbb7452aa6 100644 --- a/llvm/unittests/CodeGen/DIEHashTest.cpp +++ b/llvm/unittests/CodeGen/DIEHashTest.cpp @@ -662,8 +662,7 @@ TEST_F(DIEHashTest, MemberSdata) { // A a; TEST_F(DIEHashTest, MemberBlock) { if (!this->getAsmPrinter()) - // TODO: Use GTEST_SKIP() when GTest is updated to version 1.10.0 - return; + GTEST_SKIP(); DIE &A = *DIE::get(Alloc, dwarf::DW_TAG_structure_type); DIEInteger One(1); diff --git a/llvm/unittests/CodeGen/DIETest.cpp b/llvm/unittests/CodeGen/DIETest.cpp index 2e3f7b5f76c1..73754fe6df3e 100644 --- a/llvm/unittests/CodeGen/DIETest.cpp +++ b/llvm/unittests/CodeGen/DIETest.cpp @@ -31,6 +31,8 @@ protected: TestAsmPrinter::create("x86_64-pc-linux", Version, Format); ASSERT_THAT_EXPECTED(ExpectedTestPrinter, Succeeded()); TestPrinter = std::move(ExpectedTestPrinter.get()); + if (!TestPrinter) + GTEST_SKIP(); } dwarf::Form Form; @@ -51,17 +53,11 @@ struct DIEExprFixture : public DIEFixtureBase { }; TEST_P(DIEExprFixture, SizeOf) { - if (!TestPrinter) - return; - DIEExpr Tst(Val); EXPECT_EQ(Size, Tst.SizeOf(TestPrinter->getAP(), Form)); } TEST_P(DIEExprFixture, EmitValue) { - if (!TestPrinter) - return; - DIEExpr Tst(Val); EXPECT_CALL(TestPrinter->getMS(), emitValueImpl(Val, Size, _)); Tst.emitValue(TestPrinter->getAP(), Form); @@ -90,17 +86,11 @@ struct DIELabelFixture : public DIEFixtureBase { }; TEST_P(DIELabelFixture, SizeOf) { - if (!TestPrinter) - return; - DIELabel Tst(Val); EXPECT_EQ(Size, Tst.SizeOf(TestPrinter->getAP(), Form)); } TEST_P(DIELabelFixture, EmitValue) { - if (!TestPrinter) - return; - DIELabel Tst(Val); const MCExpr *Arg0 = nullptr; @@ -142,17 +132,11 @@ struct DIEDeltaFixture : public DIEFixtureBase { }; TEST_P(DIEDeltaFixture, SizeOf) { - if (!TestPrinter) - return; - DIEDelta Tst(Hi, Lo); EXPECT_EQ(Size, Tst.SizeOf(TestPrinter->getAP(), Form)); } TEST_P(DIEDeltaFixture, EmitValue) { - if (!TestPrinter) - return; - DIEDelta Tst(Hi, Lo); EXPECT_CALL(TestPrinter->getMS(), emitAbsoluteSymbolDiff(Hi, Lo, Size)); Tst.emitValue(TestPrinter->getAP(), Form); @@ -173,9 +157,6 @@ struct DIELocListFixture : public DIEFixtureBase { }; TEST_P(DIELocListFixture, SizeOf) { - if (!TestPrinter) - return; - DIELocList Tst(999); EXPECT_EQ(Size, Tst.SizeOf(TestPrinter->getAP(), Form)); } diff --git a/llvm/unittests/CodeGen/PassManagerTest.cpp b/llvm/unittests/CodeGen/PassManagerTest.cpp index 3bb11cf82303..7fe835d5a266 100644 --- a/llvm/unittests/CodeGen/PassManagerTest.cpp +++ b/llvm/unittests/CodeGen/PassManagerTest.cpp @@ -203,7 +203,7 @@ public: TEST_F(PassManagerTest, Basic) { if (!TM) - return; + GTEST_SKIP(); LLVMTargetMachine *LLVMTM = static_cast(TM.get()); M->setDataLayout(TM->createDataLayout()); diff --git a/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp b/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp index 626176d4ba9a..b7c519971589 100644 --- a/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp +++ b/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp @@ -42,14 +42,14 @@ protected: // initialize a target. A skeleton Target for unittests would allow us to // always run these tests. if (!T) - return; + GTEST_SKIP(); TargetOptions Options; TM = std::unique_ptr(static_cast( T->createTargetMachine("AArch64", "", "+sve", Options, None, None, CodeGenOpt::Aggressive))); if (!TM) - return; + GTEST_SKIP(); SMDiagnostic SMError; M = parseAssemblyString(Assembly, SMError, Context); @@ -94,8 +94,6 @@ protected: }; TEST_F(SelectionDAGAddressAnalysisTest, sameFrameObject) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); auto VecVT = EVT::getVectorVT(Context, Int8VT, 4); @@ -119,8 +117,6 @@ TEST_F(SelectionDAGAddressAnalysisTest, sameFrameObject) { } TEST_F(SelectionDAGAddressAnalysisTest, noAliasingFrameObjects) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // <4 x i8> @@ -153,8 +149,6 @@ TEST_F(SelectionDAGAddressAnalysisTest, noAliasingFrameObjects) { } TEST_F(SelectionDAGAddressAnalysisTest, unknownSizeFrameObjects) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // @@ -184,8 +178,6 @@ TEST_F(SelectionDAGAddressAnalysisTest, unknownSizeFrameObjects) { } TEST_F(SelectionDAGAddressAnalysisTest, globalWithFrameObject) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // @@ -218,8 +210,6 @@ TEST_F(SelectionDAGAddressAnalysisTest, globalWithFrameObject) { } TEST_F(SelectionDAGAddressAnalysisTest, fixedSizeFrameObjectsWithinDiff) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // @@ -259,8 +249,6 @@ TEST_F(SelectionDAGAddressAnalysisTest, fixedSizeFrameObjectsWithinDiff) { } TEST_F(SelectionDAGAddressAnalysisTest, fixedSizeFrameObjectsOutOfDiff) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // @@ -297,8 +285,6 @@ TEST_F(SelectionDAGAddressAnalysisTest, fixedSizeFrameObjectsOutOfDiff) { } TEST_F(SelectionDAGAddressAnalysisTest, twoFixedStackObjects) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // diff --git a/llvm/unittests/CodeGen/TargetOptionsTest.cpp b/llvm/unittests/CodeGen/TargetOptionsTest.cpp index c7d1d28928df..bc71642aa6e9 100644 --- a/llvm/unittests/CodeGen/TargetOptionsTest.cpp +++ b/llvm/unittests/CodeGen/TargetOptionsTest.cpp @@ -48,7 +48,7 @@ static void targetOptionsTest(bool EnableIPRA) { std::unique_ptr TM = createTargetMachine(EnableIPRA); // This test is designed for the X86 backend; stop if it is not available. if (!TM) - return; + GTEST_SKIP(); legacy::PassManager PM; LLVMTargetMachine *LLVMTM = static_cast(TM.get());