diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2017-04-14 23:47:53 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2017-04-14 23:47:53 +0000 |
commit | 044f956f9af8b8f4c8a2ccf5dde5cd48d34a5721 (patch) | |
tree | 91f0a52a7db2705353ea68d6f4efc17a784e0954 /llvm/unittests/Analysis/ScalarEvolutionTest.cpp | |
parent | cf8a8294e5b09ce3605b4a8a586e7d1a7a1e0b63 (diff) | |
download | bcm5719-llvm-044f956f9af8b8f4c8a2ccf5dde5cd48d34a5721.tar.gz bcm5719-llvm-044f956f9af8b8f4c8a2ccf5dde5cd48d34a5721.zip |
Generalize SCEV's unit testing helper a bit
llvm-svn: 300379
Diffstat (limited to 'llvm/unittests/Analysis/ScalarEvolutionTest.cpp')
-rw-r--r-- | llvm/unittests/Analysis/ScalarEvolutionTest.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp index d0c3fd99b43..df9fd4b5ec3 100644 --- a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp +++ b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp @@ -51,13 +51,13 @@ protected: return ScalarEvolution(F, TLI, *AC, *DT, *LI); } - void runWithFunctionAndSE( + void runWithSE( Module &M, StringRef FuncName, - function_ref<void(Function &F, ScalarEvolution &SE)> Test) { + function_ref<void(Function &F, LoopInfo &LI, ScalarEvolution &SE)> Test) { auto *F = M.getFunction(FuncName); ASSERT_NE(F, nullptr) << "Could not find " << FuncName; ScalarEvolution SE = buildSE(*F); - Test(*F, SE); + Test(*F, *LI, SE); } }; @@ -419,7 +419,7 @@ TEST_F(ScalarEvolutionsTest, CommutativeExprOperandOrder) { assert(M && "Could not parse module?"); assert(!verifyModule(*M) && "Must have been well formed!"); - runWithFunctionAndSE(*M, "f_1", [&](Function &F, ScalarEvolution &SE) { + runWithSE(*M, "f_1", [&](Function &F, LoopInfo &LI, ScalarEvolution &SE) { auto *IV0 = getInstructionByName(F, "iv0"); auto *IV0Inc = getInstructionByName(F, "iv0.inc"); @@ -460,11 +460,12 @@ TEST_F(ScalarEvolutionsTest, CommutativeExprOperandOrder) { }; for (StringRef FuncName : {"f_2", "f_3", "f_4"}) - runWithFunctionAndSE(*M, FuncName, [&](Function &F, ScalarEvolution &SE) { - CheckCommutativeMulExprs(SE, SE.getSCEV(getInstructionByName(F, "x")), - SE.getSCEV(getInstructionByName(F, "y")), - SE.getSCEV(getInstructionByName(F, "z"))); - }); + runWithSE( + *M, FuncName, [&](Function &F, LoopInfo &LI, ScalarEvolution &SE) { + CheckCommutativeMulExprs(SE, SE.getSCEV(getInstructionByName(F, "x")), + SE.getSCEV(getInstructionByName(F, "y")), + SE.getSCEV(getInstructionByName(F, "z"))); + }); } TEST_F(ScalarEvolutionsTest, CompareSCEVComplexity) { @@ -645,7 +646,7 @@ TEST_F(ScalarEvolutionsTest, SCEVNormalization) { assert(M && "Could not parse module?"); assert(!verifyModule(*M) && "Must have been well formed!"); - runWithFunctionAndSE(*M, "f_1", [&](Function &F, ScalarEvolution &SE) { + runWithSE(*M, "f_1", [&](Function &F, LoopInfo &LI, ScalarEvolution &SE) { auto &I0 = GetInstByName(F, "iv0"); auto &I1 = *I0.getNextNode(); |