[PATCH] D39364: [Polly][acc] Do not statically dispatch into IslNodeBuilder's createFor

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 29 14:37:03 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL316872: [Acc] Do not statically dispatch into IslNodeBuilder's createFor (authored by pfaffe).

Repository:
  rL LLVM

https://reviews.llvm.org/D39364

Files:
  polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
  polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
  polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp


Index: polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
===================================================================
--- polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
+++ polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
@@ -351,7 +351,7 @@
   bool preloadInvariantEquivClass(InvariantEquivClassTy &IAClass);
 
   void createForVector(__isl_take isl_ast_node *For, int VectorWidth);
-  void createForSequential(__isl_take isl_ast_node *For, bool KnownParallel);
+  void createForSequential(__isl_take isl_ast_node *For, bool MarkParallel);
 
   /// Create LLVM-IR that executes a for node thread parallel.
   ///
Index: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
===================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
@@ -530,19 +530,15 @@
 }
 
 void IslNodeBuilder::createForSequential(__isl_take isl_ast_node *For,
-                                         bool KnownParallel) {
+                                         bool MarkParallel) {
   isl_ast_node *Body;
   isl_ast_expr *Init, *Inc, *Iterator, *UB;
   isl_id *IteratorID;
   Value *ValueLB, *ValueUB, *ValueInc;
   Type *MaxType;
   BasicBlock *ExitBlock;
   Value *IV;
   CmpInst::Predicate Predicate;
-  bool Parallel;
-
-  Parallel = KnownParallel || (IslAstInfo::isParallel(For) &&
-                               !IslAstInfo::isReductionParallel(For));
 
   bool LoopVectorizerDisabled =
       IsLoopVectorizerDisabled(isl::manage(isl_ast_node_copy(For)));
@@ -582,13 +578,13 @@
   bool UseGuardBB =
       !SE.isKnownPredicate(Predicate, SE.getSCEV(ValueLB), SE.getSCEV(ValueUB));
   IV = createLoop(ValueLB, ValueUB, ValueInc, Builder, LI, DT, ExitBlock,
-                  Predicate, &Annotator, Parallel, UseGuardBB,
+                  Predicate, &Annotator, MarkParallel, UseGuardBB,
                   LoopVectorizerDisabled);
   IDToValue[IteratorID] = IV;
 
   create(Body);
 
-  Annotator.popLoop(Parallel);
+  Annotator.popLoop(MarkParallel);
 
   IDToValue.erase(IDToValue.find(IteratorID));
 
@@ -795,7 +791,9 @@
     createForParallel(For);
     return;
   }
-  createForSequential(For, false);
+  bool Parallel =
+      (IslAstInfo::isParallel(For) && !IslAstInfo::isReductionParallel(For));
+  createForSequential(For, Parallel);
 }
 
 void IslNodeBuilder::createIf(__isl_take isl_ast_node *If) {
Index: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
===================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -415,6 +415,8 @@
   /// @param UserStmt The ast node to generate code for.
   virtual void createUser(__isl_take isl_ast_node *UserStmt);
 
+  virtual void createFor(__isl_take isl_ast_node *Node);
+
   enum DataDirection { HOST_TO_DEVICE, DEVICE_TO_HOST };
 
   /// Create code for a data transfer statement
@@ -1286,6 +1288,11 @@
   isl_ast_node_free(UserStmt);
   return;
 }
+
+void GPUNodeBuilder::createFor(__isl_take isl_ast_node *Node) {
+  createForSequential(Node, false);
+}
+
 void GPUNodeBuilder::createKernelCopy(ppcg_kernel_stmt *KernelStmt) {
   isl_ast_expr *LocalIndex = isl_ast_expr_copy(KernelStmt->u.c.local_index);
   LocalIndex = isl_ast_expr_address_of(LocalIndex);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39364.120757.patch
Type: text/x-patch
Size: 3319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171029/fc6f9934/attachment.bin>


More information about the llvm-commits mailing list