[UnitTests] UnrollAnalyzer: make unit-test more general so that it can cover more cases in future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261954 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael Zolotukhin 2016-02-26 01:44:04 +00:00
parent 5e86c5c682
commit 30deba6b59

View File

@ -32,14 +32,16 @@ struct UnrollAnalyzerTest : public FunctionPass {
FI++; // First basic block is entry - skip it.
BasicBlock *Header = &*FI++;
Loop *L = LI->getLoopFor(Header);
BasicBlock *Exiting = L->getExitingBlock();
SimplifiedValuesVector.clear();
TripCount = SE->getSmallConstantTripCount(L, Header);
TripCount = SE->getSmallConstantTripCount(L, Exiting);
for (unsigned Iteration = 0; Iteration < TripCount; Iteration++) {
DenseMap<Value *, Constant *> SimplifiedValues;
UnrolledInstAnalyzer Analyzer(Iteration, SimplifiedValues, *SE);
for (Instruction &I : *Header)
Analyzer.visit(I);
for (auto *BB : L->getBlocks())
for (Instruction &I : *BB)
Analyzer.visit(I);
SimplifiedValuesVector.push_back(SimplifiedValues);
}
return false;