summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2015-09-05 13:03:57 +0000
committerTobias Grosser <tobias@grosser.es>2015-09-05 13:03:57 +0000
commitabcec37f642cf875ae0d6d76d8f595b1d99950e9 (patch)
treed996c23375e00ddf6ef109c8ece5cffbc4789b7e
parenta1ceba8ab4a0da0ec36b47f13d94f441709c08cd (diff)
downloadbcm5719-llvm-abcec37f642cf875ae0d6d76d8f595b1d99950e9.tar.gz
bcm5719-llvm-abcec37f642cf875ae0d6d76d8f595b1d99950e9.zip
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. llvm-svn: 246928
-rw-r--r--polly/include/polly/CodeGen/IslNodeBuilder.h5
-rw-r--r--polly/lib/CodeGen/IslNodeBuilder.cpp10
2 files changed, 9 insertions, 6 deletions
diff --git a/polly/include/polly/CodeGen/IslNodeBuilder.h b/polly/include/polly/CodeGen/IslNodeBuilder.h
index 221d8bd0e08..dc45e630189 100644
--- a/polly/include/polly/CodeGen/IslNodeBuilder.h
+++ b/polly/include/polly/CodeGen/IslNodeBuilder.h
@@ -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.
diff --git a/polly/lib/CodeGen/IslNodeBuilder.cpp b/polly/lib/CodeGen/IslNodeBuilder.cpp
index 5c866a54b72..1a726dc9468 100644
--- a/polly/lib/CodeGen/IslNodeBuilder.cpp
+++ b/polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -298,7 +298,7 @@ void IslNodeBuilder::createUserVector(__isl_take isl_ast_node *User,
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_ast_node *If) {
__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_take isl_ast_node *User) {
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())
OpenPOWER on IntegriCloud