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
This commit is contained in:
parent
a1ceba8ab4
commit
abcec37f64
|
@ -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.
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue