diff --git a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp --- a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp +++ b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp @@ -37,14 +37,14 @@ // 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 @@ }; 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, 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, 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, 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, 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, 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, SimplifyDemandedVectorElts_EXTRACT_SUBVECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -198,9 +183,6 @@ } TEST_F(AArch64SelectionDAGTest, SimplifyDemandedBitsNEON) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -227,9 +209,6 @@ } TEST_F(AArch64SelectionDAGTest, SimplifyDemandedBitsSVE) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -254,8 +233,6 @@ // 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 @@ // 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, isSplatValue_Fixed_BUILD_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -318,9 +290,6 @@ } 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_Scalable_SPLAT_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -368,9 +334,6 @@ } TEST_F(AArch64SelectionDAGTest, isSplatValue_Scalable_ADD_of_SPLAT_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -395,9 +358,6 @@ } TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Fixed_BUILD_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -413,9 +373,6 @@ } 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_Scalable_SPLAT_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -452,9 +406,6 @@ } TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Scalable_ADD_of_SPLAT_VECTOR) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -473,9 +424,6 @@ } TEST_F(AArch64SelectionDAGTest, getRepeatedSequence_Patterns) { - if (!TM) - return; - TargetLowering TL(*TM); SDLoc Loc; @@ -594,45 +542,30 @@ } 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_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 --- a/llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp +++ b/llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp @@ -70,7 +70,7 @@ 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, 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, 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, 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, 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, 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 @@ 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, 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, 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, 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 @@ 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, 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 @@ 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, 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 @@ 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 @@ 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, 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 @@ 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, DWARF64) { if (!init("x86_64-pc-linux", /*DwarfVersion=*/4, dwarf::DWARF64)) - return; + GTEST_SKIP(); InSequence S; const MCSymbol *Hi = nullptr; @@ -421,7 +421,7 @@ 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 --- a/llvm/unittests/CodeGen/DIEHashTest.cpp +++ b/llvm/unittests/CodeGen/DIEHashTest.cpp @@ -662,8 +662,7 @@ // 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 --- a/llvm/unittests/CodeGen/DIETest.cpp +++ b/llvm/unittests/CodeGen/DIETest.cpp @@ -31,6 +31,8 @@ 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 @@ }; 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 @@ }; 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 @@ }; 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 @@ }; 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 --- a/llvm/unittests/CodeGen/PassManagerTest.cpp +++ b/llvm/unittests/CodeGen/PassManagerTest.cpp @@ -203,7 +203,7 @@ 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 --- a/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp +++ b/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp @@ -42,14 +42,14 @@ // 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 @@ }; 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, noAliasingFrameObjects) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // <4 x i8> @@ -153,8 +149,6 @@ } TEST_F(SelectionDAGAddressAnalysisTest, unknownSizeFrameObjects) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // @@ -184,8 +178,6 @@ } TEST_F(SelectionDAGAddressAnalysisTest, globalWithFrameObject) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // @@ -218,8 +210,6 @@ } TEST_F(SelectionDAGAddressAnalysisTest, fixedSizeFrameObjectsWithinDiff) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // @@ -259,8 +249,6 @@ } TEST_F(SelectionDAGAddressAnalysisTest, fixedSizeFrameObjectsOutOfDiff) { - if (!TM) - return; SDLoc Loc; auto Int8VT = EVT::getIntegerVT(Context, 8); // @@ -297,8 +285,6 @@ } 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 --- a/llvm/unittests/CodeGen/TargetOptionsTest.cpp +++ b/llvm/unittests/CodeGen/TargetOptionsTest.cpp @@ -48,7 +48,7 @@ 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());