Collect and verify generated parallel subfunctions

We verify the optimized function now for a long time and it helped to track
  down bugs early. This will now also happen for all parallel subfunctions we
  generate.

llvm-svn: 265823
This commit is contained in:
Johannes Doerfert 2016-04-08 18:16:02 +00:00
parent efe3732883
commit a9dc529442
3 changed files with 13 additions and 0 deletions

View File

@ -58,6 +58,11 @@ public:
/// @return A referecne to the associated block generator.
BlockGenerator &getBlockGenerator() { return BlockGen; }
/// @brief Return the parallel subfunctions that have been created.
const ArrayRef<Function *> getParallelSubfunctions() const {
return ParallelSubfunctions;
}
protected:
Scop &S;
PollyIRBuilder &Builder;
@ -103,6 +108,9 @@ protected:
// ivs.
IslExprBuilder::IDToValueTy IDToValue;
/// @brief A collection of all parallel subfunctions that have been created.
SmallVector<Function *, 8> ParallelSubfunctions;
/// Generate code for a given SCEV*
///
/// This function generates code for a given SCEV expression. It generated

View File

@ -202,6 +202,8 @@ public:
}
verifyGeneratedFunction(S, *EnteringBB->getParent());
for (auto *SubF : NodeBuilder.getParallelSubfunctions())
verifyGeneratedFunction(S, *SubF);
// Mark the function such that we run additional cleanup passes on this
// function (e.g. mem2reg to rediscover phi nodes).

View File

@ -622,6 +622,9 @@ void IslNodeBuilder::createForParallel(__isl_take isl_ast_node *For) {
BasicBlock::iterator AfterLoop = Builder.GetInsertPoint();
Builder.SetInsertPoint(&*LoopBody);
// Remember the parallel subfunction
ParallelSubfunctions.push_back(LoopBody->getFunction());
// Save the current values.
auto ValueMapCopy = ValueMap;
IslExprBuilder::IDToValueTy IDToValueCopy = IDToValue;