Refactor canSynthesize in the BlockGenerators [NFC]

llvm-svn: 256269
This commit is contained in:
Johannes Doerfert 2015-12-22 19:08:49 +00:00
parent 7637905318
commit 5dced2693e
2 changed files with 14 additions and 6 deletions

View File

@ -550,6 +550,11 @@ protected:
/// @returns The newest version (e.g., reloaded) of the scalar value.
Value *getNewScalarValue(Value *ScalarValue, const Region &R, ScopStmt &,
LoopToScevMapT &LTS, ValueMapT &BBMap);
/// @brief Helper to determine if @p Inst can be synthezised in @p Stmt.
///
/// @returns false, iff @p Inst can be synthesized in @p Stmt.
bool canSyntheziseInStmt(ScopStmt &Stmt, Instruction *Inst);
};
/// @brief Generate a new vector basic block for a polyhedral statement.

View File

@ -238,6 +238,12 @@ void BlockGenerator::generateScalarStore(ScopStmt &Stmt, StoreInst *Store,
Builder.CreateAlignedStore(ValueOperand, NewPointer, Store->getAlignment());
}
bool BlockGenerator::canSyntheziseInStmt(ScopStmt &Stmt, Instruction *Inst) {
Loop *L = getLoopForInst(Inst);
return (Stmt.isBlockStmt() || !Stmt.getRegion()->contains(L)) &&
canSynthesize(Inst, &LI, &SE, &Stmt.getParent()->getRegion());
}
void BlockGenerator::copyInstruction(ScopStmt &Stmt, Instruction *Inst,
ValueMapT &BBMap, LoopToScevMapT &LTS,
isl_id_to_ast_expr *NewAccesses) {
@ -246,12 +252,9 @@ void BlockGenerator::copyInstruction(ScopStmt &Stmt, Instruction *Inst,
if (Inst->isTerminator())
return;
Loop *L = getLoopForInst(Inst);
if ((Stmt.isBlockStmt() || !Stmt.getRegion()->contains(L)) &&
canSynthesize(Inst, &LI, &SE, &Stmt.getParent()->getRegion())) {
// Synthesizable statements will be generated on-demand.
// Synthesizable statements will be generated on-demand.
if (canSyntheziseInStmt(Stmt, Inst))
return;
}
if (auto *Load = dyn_cast<LoadInst>(Inst)) {
Value *NewLoad = generateScalarLoad(Stmt, Load, BBMap, LTS, NewAccesses);
@ -942,7 +945,7 @@ void VectorBlockGenerator::copyInstruction(
if (Inst->isTerminator())
return;
if (canSynthesize(Inst, &LI, &SE, &Stmt.getParent()->getRegion()))
if (canSyntheziseInStmt(Stmt, Inst))
return;
if (auto *Load = dyn_cast<LoadInst>(Inst)) {