[polly] r256269 - Refactor canSynthesize in the BlockGenerators [NFC]

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 11:08:50 PST 2015


Author: jdoerfert
Date: Tue Dec 22 13:08:49 2015
New Revision: 256269

URL: http://llvm.org/viewvc/llvm-project?rev=256269&view=rev
Log:
Refactor canSynthesize in the BlockGenerators [NFC]

Modified:
    polly/trunk/include/polly/CodeGen/BlockGenerators.h
    polly/trunk/lib/CodeGen/BlockGenerators.cpp

Modified: polly/trunk/include/polly/CodeGen/BlockGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/BlockGenerators.h?rev=256269&r1=256268&r2=256269&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/BlockGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/BlockGenerators.h Tue Dec 22 13:08:49 2015
@@ -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.

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=256269&r1=256268&r2=256269&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Tue Dec 22 13:08:49 2015
@@ -238,6 +238,12 @@ void BlockGenerator::generateScalarStore
   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(Sco
   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::copyInstructi
   if (Inst->isTerminator())
     return;
 
-  if (canSynthesize(Inst, &LI, &SE, &Stmt.getParent()->getRegion()))
+  if (canSyntheziseInStmt(Stmt, Inst))
     return;
 
   if (auto *Load = dyn_cast<LoadInst>(Inst)) {




More information about the llvm-commits mailing list