[polly] r246928 - IslNodeBuilder: Only obtain the isl_ast_build, when needed

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 5 06:03:58 PDT 2015


Author: grosser
Date: Sat Sep  5 08:03:57 2015
New Revision: 246928

URL: http://llvm.org/viewvc/llvm-project?rev=246928&view=rev
Log:
IslNodeBuilder: Only obtain the isl_ast_build, when needed

In the common case, the access functions are not modified, hence there is no
need to obtain the IslAstBuild context at all. This should not only be minimally
faster, but this also allows the IslNodeBuilder to work on asts that are not
annotated with isl_ast_builds as long as the memory accesses are not modified.

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

Modified: polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslNodeBuilder.h?rev=246928&r1=246927&r2=246928&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslNodeBuilder.h (original)
+++ polly/trunk/include/polly/CodeGen/IslNodeBuilder.h Sat Sep  5 08:03:57 2015
@@ -207,13 +207,14 @@ protected:
   /// individual memory references in the statement (identified by their id)
   /// to these newly generated ast expressions.
   ///
-  /// @param Build The build to use to generate these expressions.
   /// @param Stmt  The statement for which to (possibly) generate new access
   ///              functions.
+  /// @param Node  The ast node corresponding to the statement for us to extract
+  ///              the local schedule from.
   /// @return A new hash table that contains remappings from memory ids to new
   ///         access expressions.
   __isl_give isl_id_to_ast_expr *
-  createNewAccesses(ScopStmt *Stmt, __isl_keep isl_ast_build *Build);
+  createNewAccesses(ScopStmt *Stmt, __isl_keep isl_ast_node *Node);
 
   /// Generate LLVM-IR that computes the values of the original induction
   /// variables in function of the newly generated loop induction variables.

Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=246928&r1=246927&r2=246928&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Sat Sep  5 08:03:57 2015
@@ -298,7 +298,7 @@ void IslNodeBuilder::createUserVector(__
   Schedule = isl_union_map_intersect_domain(Schedule, Domain);
   isl_map *S = isl_map_from_union_map(Schedule);
 
-  auto *NewAccesses = createNewAccesses(Stmt, IslAstInfo::getBuild(User));
+  auto *NewAccesses = createNewAccesses(Stmt, User);
   createSubstitutionsVector(Expr, Stmt, VLTS, IVS, IteratorID);
   VectorBlockGenerator::generate(BlockGen, *Stmt, VLTS, S, NewAccesses);
   isl_id_to_ast_expr_free(NewAccesses);
@@ -647,13 +647,15 @@ void IslNodeBuilder::createIf(__isl_take
 
 __isl_give isl_id_to_ast_expr *
 IslNodeBuilder::createNewAccesses(ScopStmt *Stmt,
-                                  __isl_keep isl_ast_build *Build) {
+                                  __isl_keep isl_ast_node *Node) {
   isl_id_to_ast_expr *NewAccesses =
-      isl_id_to_ast_expr_alloc(isl_ast_build_get_ctx(Build), 0);
+      isl_id_to_ast_expr_alloc(Stmt->getParent()->getIslCtx(), 0);
   for (auto *MA : *Stmt) {
     if (!MA->hasNewAccessRelation())
       continue;
 
+    auto Build = IslAstInfo::getBuild(Node);
+    assert(Build && "Could not obtain isl_ast_build from user node");
     auto Schedule = isl_ast_build_get_schedule(Build);
     auto PWAccRel = MA->applyScheduleToAccessRelation(Schedule);
 
@@ -714,7 +716,7 @@ void IslNodeBuilder::createUser(__isl_ta
   LTS.insert(OutsideLoopIterations.begin(), OutsideLoopIterations.end());
 
   Stmt = (ScopStmt *)isl_id_get_user(Id);
-  auto *NewAccesses = createNewAccesses(Stmt, IslAstInfo::getBuild(User));
+  auto *NewAccesses = createNewAccesses(Stmt, User);
   createSubstitutions(Expr, Stmt, LTS);
 
   if (Stmt->isBlockStmt())




More information about the llvm-commits mailing list