From: Chandler Carruth Date: Fri, 2 Sep 2016 01:14:05 +0000 (+0000) Subject: [PM] (NFC) Split the IR parsing into a fixture so that I can split out X-Git-Tag: llvmorg-4.0.0-rc1~10812 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f83742ab685d72cf97d699e398f418d3f565f4c;p=platform%2Fupstream%2Fllvm.git [PM] (NFC) Split the IR parsing into a fixture so that I can split out more testing into other test routines while using the same core module. llvm-svn: 280446 --- diff --git a/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp b/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp index 828ec99..eaf2b52 100644 --- a/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp +++ b/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp @@ -158,39 +158,48 @@ std::unique_ptr parseIR(const char *IR) { return parseAssemblyString(IR, Err, C); } -TEST(CGSCCPassManagerTest, Basic) { - auto M = parseIR("define void @f() {\n" - "entry:\n" - " call void @g()\n" - " call void @h1()\n" - " ret void\n" - "}\n" - "define void @g() {\n" - "entry:\n" - " call void @g()\n" - " call void @x()\n" - " ret void\n" - "}\n" - "define void @h1() {\n" - "entry:\n" - " call void @h2()\n" - " ret void\n" - "}\n" - "define void @h2() {\n" - "entry:\n" - " call void @h3()\n" - " call void @x()\n" - " ret void\n" - "}\n" - "define void @h3() {\n" - "entry:\n" - " call void @h1()\n" - " ret void\n" - "}\n" - "define void @x() {\n" - "entry:\n" - " ret void\n" - "}\n"); +class CGSCCPassManagerTest : public ::testing::Test { +protected: + LLVMContext Context; + std::unique_ptr M; + +public: + CGSCCPassManagerTest() + : M(parseIR("define void @f() {\n" + "entry:\n" + " call void @g()\n" + " call void @h1()\n" + " ret void\n" + "}\n" + "define void @g() {\n" + "entry:\n" + " call void @g()\n" + " call void @x()\n" + " ret void\n" + "}\n" + "define void @h1() {\n" + "entry:\n" + " call void @h2()\n" + " ret void\n" + "}\n" + "define void @h2() {\n" + "entry:\n" + " call void @h3()\n" + " call void @x()\n" + " ret void\n" + "}\n" + "define void @h3() {\n" + "entry:\n" + " call void @h1()\n" + " ret void\n" + "}\n" + "define void @x() {\n" + "entry:\n" + " ret void\n" + "}\n")) {} +}; + +TEST_F(CGSCCPassManagerTest, Basic) { FunctionAnalysisManager FAM(/*DebugLogging*/ true); int FunctionAnalysisRuns = 0; FAM.registerPass([&] { return TestFunctionAnalysis(FunctionAnalysisRuns); });