From 32c88043afeb991065624d77ae687c07fdf9abbc Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Thu, 10 Nov 2016 07:56:05 +0000 Subject: [PATCH] Lift out a helper lambda; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286436 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Analysis/ScalarEvolutionTest.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/unittests/Analysis/ScalarEvolutionTest.cpp b/unittests/Analysis/ScalarEvolutionTest.cpp index f78de8c0371..6dcb18fd94b 100644 --- a/unittests/Analysis/ScalarEvolutionTest.cpp +++ b/unittests/Analysis/ScalarEvolutionTest.cpp @@ -50,6 +50,15 @@ protected: LI.reset(new LoopInfo(*DT)); return ScalarEvolution(F, TLI, *AC, *DT, *LI); } + + void runWithFunctionAndSE( + Module &M, StringRef FuncName, + function_ref Test) { + auto *F = M.getFunction(FuncName); + ASSERT_NE(F, nullptr) << "Could not find " << FuncName; + ScalarEvolution SE = buildSE(*F); + Test(*F, SE); + } }; TEST_F(ScalarEvolutionsTest, SCEVUnknownRAUW) { @@ -408,16 +417,7 @@ TEST_F(ScalarEvolutionsTest, CommutativeExprOperandOrder) { assert(M && "Could not parse module?"); assert(!verifyModule(*M) && "Must have been well formed!"); - auto RunWithFunctionAndSE = - [&](StringRef FuncName, - function_ref Test) { - auto *F = M->getFunction(FuncName); - ASSERT_NE(F, nullptr) << "Could not find " << FuncName; - ScalarEvolution SE = buildSE(*F); - Test(*F, SE); - }; - - RunWithFunctionAndSE("f_1", [&](Function &F, ScalarEvolution &SE) { + runWithFunctionAndSE(*M, "f_1", [&](Function &F, ScalarEvolution &SE) { auto *IV0 = getInstructionByName(F, "iv0"); auto *IV0Inc = getInstructionByName(F, "iv0.inc"); @@ -458,7 +458,7 @@ TEST_F(ScalarEvolutionsTest, CommutativeExprOperandOrder) { }; for (StringRef FuncName : {"f_2", "f_3", "f_4"}) - RunWithFunctionAndSE(FuncName, [&](Function &F, ScalarEvolution &SE) { + runWithFunctionAndSE(*M, FuncName, [&](Function &F, ScalarEvolution &SE) { CheckCommutativeMulExprs(SE, SE.getSCEV(getInstructionByName(F, "x")), SE.getSCEV(getInstructionByName(F, "y")), SE.getSCEV(getInstructionByName(F, "z"))); -- 2.40.0