diff options
-rw-r--r-- | polly/include/polly/CodeGen/BlockGenerators.h | 5 | ||||
-rw-r--r-- | polly/lib/CodeGen/BlockGenerators.cpp | 15 |
2 files changed, 14 insertions, 6 deletions
diff --git a/polly/include/polly/CodeGen/BlockGenerators.h b/polly/include/polly/CodeGen/BlockGenerators.h index 257361c8f4a..8ae392684ad 100644 --- a/polly/include/polly/CodeGen/BlockGenerators.h +++ b/polly/include/polly/CodeGen/BlockGenerators.h @@ -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 <S, 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. diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index b29e78471a2..9aaff0d8e39 100644 --- a/polly/lib/CodeGen/BlockGenerators.cpp +++ b/polly/lib/CodeGen/BlockGenerators.cpp @@ -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 <S, 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)) { |