diff options
author | Tobias Grosser <tobias@grosser.es> | 2018-02-20 07:26:58 +0000 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2018-02-20 07:26:58 +0000 |
commit | 718d04c6534cc83f8d48b9ce94dcb3f46e02a7e7 (patch) | |
tree | 429d7e53ecf79e249703e665448fafbb236860cb | |
parent | fa8079d0dc1b9fbca201b92f30d3c97386c75114 (diff) | |
download | bcm5719-llvm-718d04c6534cc83f8d48b9ce94dcb3f46e02a7e7.tar.gz bcm5719-llvm-718d04c6534cc83f8d48b9ce94dcb3f46e02a7e7.zip |
Use isl::manage_copy to simplify calls to isl::manage(isl_.._copy())
As part of this cleanup a couple of unnecessary isl::manage(obj.copy()) pattern
are eliminated as well.
We checked for all potential cleanups by scanning for:
"grep -R isl::manage\( lib/ | grep copy"
llvm-svn: 325558
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 2 | ||||
-rw-r--r-- | polly/lib/CodeGen/BlockGenerators.cpp | 8 | ||||
-rw-r--r-- | polly/lib/CodeGen/IslAst.cpp | 11 | ||||
-rw-r--r-- | polly/lib/CodeGen/IslNodeBuilder.cpp | 7 | ||||
-rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 19 | ||||
-rw-r--r-- | polly/lib/Support/ISLTools.cpp | 16 | ||||
-rw-r--r-- | polly/lib/Support/SCEVAffinator.cpp | 3 | ||||
-rw-r--r-- | polly/lib/Transform/DeLICM.cpp | 3 | ||||
-rw-r--r-- | polly/lib/Transform/ScheduleOptimizer.cpp | 17 |
9 files changed, 37 insertions, 49 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index c8d3f6b5e6a..9c0a037c213 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -3484,7 +3484,7 @@ void Scop::foldSizeConstantsToRight() { for (auto &Access : AccessFunctions) if (Access->getScopArrayInfo() == Array) Access->setAccessRelation(Access->getAccessRelation().apply_range( - isl::manage(isl_map_copy(Transform)))); + isl::manage_copy(Transform))); isl_map_free(Transform); diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index 29c29fff3a5..4632765cc43 100644 --- a/polly/lib/CodeGen/BlockGenerators.cpp +++ b/polly/lib/CodeGen/BlockGenerators.cpp @@ -1040,11 +1040,11 @@ void VectorBlockGenerator::generateLoad( extractScalarValues(Load, VectorMap, ScalarMaps); Value *NewLoad; - if (Access.isStrideZero(isl::manage(isl_map_copy(Schedule)))) + if (Access.isStrideZero(isl::manage_copy(Schedule))) NewLoad = generateStrideZeroLoad(Stmt, Load, ScalarMaps[0], NewAccesses); - else if (Access.isStrideOne(isl::manage(isl_map_copy(Schedule)))) + else if (Access.isStrideOne(isl::manage_copy(Schedule))) NewLoad = generateStrideOneLoad(Stmt, Load, ScalarMaps, NewAccesses); - else if (Access.isStrideX(isl::manage(isl_map_copy(Schedule)), -1)) + else if (Access.isStrideX(isl::manage_copy(Schedule), -1)) NewLoad = generateStrideOneLoad(Stmt, Load, ScalarMaps, NewAccesses, true); else NewLoad = generateUnknownStrideLoad(Stmt, Load, ScalarMaps, NewAccesses); @@ -1095,7 +1095,7 @@ void VectorBlockGenerator::copyStore( // the data location. extractScalarValues(Store, VectorMap, ScalarMaps); - if (Access.isStrideOne(isl::manage(isl_map_copy(Schedule)))) { + if (Access.isStrideOne(isl::manage_copy(Schedule))) { Type *VectorPtrType = getVectorPtrTy(Pointer, getVectorWidth()); Value *NewPointer = generateLocationAccessed(Stmt, Store, ScalarMaps[0], VLTS[0], NewAccesses); diff --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp index dddfbab412b..442411bf70e 100644 --- a/polly/lib/CodeGen/IslAst.cpp +++ b/polly/lib/CodeGen/IslAst.cpp @@ -439,14 +439,12 @@ IslAst::buildRunCondition(Scop &S, __isl_keep isl_ast_build *Build) { for (auto RWAccIt1 = RWAccIt0 + 1; RWAccIt1 != RWAccEnd; ++RWAccIt1) RunCondition = isl_ast_expr_and( RunCondition, - buildCondition(S, isl::manage(isl_ast_build_copy(Build)), RWAccIt0, - RWAccIt1) + buildCondition(S, isl::manage_copy(Build), RWAccIt0, RWAccIt1) .release()); for (const Scop::MinMaxAccessTy &ROAccIt : MinMaxReadOnly) RunCondition = isl_ast_expr_and( RunCondition, - buildCondition(S, isl::manage(isl_ast_build_copy(Build)), RWAccIt0, - &ROAccIt) + buildCondition(S, isl::manage_copy(Build), RWAccIt0, &ROAccIt) .release()); } } @@ -683,7 +681,7 @@ static __isl_give isl_printer *cbPrintUser(__isl_take isl_printer *P, __isl_take isl_ast_print_options *O, __isl_keep isl_ast_node *Node, void *User) { - isl::ast_node AstNode = isl::manage(isl_ast_node_copy(Node)); + isl::ast_node AstNode = isl::manage_copy(Node); isl::ast_expr NodeExpr = AstNode.user_get_expr(); isl::ast_expr CallExpr = NodeExpr.get_op_arg(0); isl::id CallExprId = CallExpr.get_id(); @@ -703,8 +701,7 @@ static __isl_give isl_printer *cbPrintUser(__isl_take isl_printer *P, else P = isl_printer_print_str(P, "/* write */ "); - isl::ast_build Build = - isl::manage(isl_ast_build_copy(IslAstInfo::getBuild(Node))); + isl::ast_build Build = isl::manage_copy(IslAstInfo::getBuild(Node)); if (MemAcc->isAffine()) { isl_pw_multi_aff *PwmaPtr = MemAcc->applyScheduleToAccessRelation(Build.get_schedule()).release(); diff --git a/polly/lib/CodeGen/IslNodeBuilder.cpp b/polly/lib/CodeGen/IslNodeBuilder.cpp index f89fa5e9472..7b315fe408e 100644 --- a/polly/lib/CodeGen/IslNodeBuilder.cpp +++ b/polly/lib/CodeGen/IslNodeBuilder.cpp @@ -540,8 +540,7 @@ void IslNodeBuilder::createForSequential(__isl_take isl_ast_node *For, Value *IV; CmpInst::Predicate Predicate; - bool LoopVectorizerDisabled = - IsLoopVectorizerDisabled(isl::manage(isl_ast_node_copy(For))); + bool LoopVectorizerDisabled = IsLoopVectorizerDisabled(isl::manage_copy(For)); Body = isl_ast_node_for_get_body(For); @@ -853,7 +852,7 @@ IslNodeBuilder::createNewAccesses(ScopStmt *Stmt, auto *Build = IslAstInfo::getBuild(Node); assert(Build && "Could not obtain isl_ast_build from user node"); - Stmt->setAstBuild(isl::manage(isl_ast_build_copy(Build))); + Stmt->setAstBuild(isl::manage_copy(Build)); for (auto *MA : *Stmt) { if (!MA->hasNewAccessRelation()) { @@ -1596,7 +1595,7 @@ Value *IslNodeBuilder::createRTC(isl_ast_expr *Condition) { // bits. These are -- in case wrapping intrinsics are used -- translated to // runtime library calls that are not available on all systems (e.g., Android) // and consequently will result in linker errors. - if (ExprBuilder.hasLargeInts(isl::manage(isl_ast_expr_copy(Condition)))) { + if (ExprBuilder.hasLargeInts(isl::manage_copy(Condition))) { isl_ast_expr_free(Condition); return Builder.getFalse(); } diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index d6652146483..5bf31e60e92 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -287,7 +287,7 @@ static __isl_give isl_id_to_ast_expr *pollyBuildAstExprForStmt( if (!Stmt || !Build_C) return NULL; - isl::ast_build Build = isl::manage(isl_ast_build_copy(Build_C)); + isl::ast_build Build = isl::manage_copy(Build_C); isl::ctx Ctx = Build.get_ctx(); isl::id_to_ast_expr RefToExpr = isl::id_to_ast_expr::alloc(Ctx, 0); @@ -1103,8 +1103,7 @@ Value *GPUNodeBuilder::getArraySize(gpu_array_info *Array) { Value *ArraySize = ConstantInt::get(Builder.getInt64Ty(), Array->size); if (!gpu_array_is_scalar(Array)) { - isl::multi_pw_aff ArrayBound = - isl::manage(isl_multi_pw_aff_copy(Array->bound)); + isl::multi_pw_aff ArrayBound = isl::manage_copy(Array->bound); isl::pw_aff OffsetDimZero = ArrayBound.get_pw_aff(0); isl::ast_expr Res = Build.expr_from(OffsetDimZero); @@ -1129,7 +1128,7 @@ Value *GPUNodeBuilder::getArrayOffset(gpu_array_info *Array) { isl::ast_build Build = isl::ast_build::from_context(S.getContext()); - isl::set Min = isl::manage(isl_set_copy(Array->extent)).lexmin(); + isl::set Min = isl::manage_copy(Array->extent).lexmin(); isl::set ZeroSet = isl::set::universe(Min.get_space()); @@ -1576,8 +1575,7 @@ std::tuple<Value *, Value *> GPUNodeBuilder::getGridSizes(ppcg_kernel *Kernel) { std::vector<Value *> Sizes; isl::ast_build Context = isl::ast_build::from_context(S.getContext()); - isl::multi_pw_aff GridSizePwAffs = - isl::manage(isl_multi_pw_aff_copy(Kernel->grid_size)); + isl::multi_pw_aff GridSizePwAffs = isl::manage_copy(Kernel->grid_size); for (long i = 0; i < Kernel->n_grid; i++) { isl::pw_aff Size = GridSizePwAffs.get_pw_aff(i); isl::ast_expr GridSize = Context.expr_from(Size); @@ -2012,8 +2010,7 @@ GPUNodeBuilder::createKernelFunctionDecl(ppcg_kernel *Kernel, Arg->setName(Kernel->array[i].array->name); isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set); - const ScopArrayInfo *SAI = - ScopArrayInfo::getFromId(isl::manage(isl_id_copy(Id))); + const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl::manage_copy(Id)); Type *EleTy = SAI->getElementType(); Value *Val = &*Arg; SmallVector<const SCEV *, 4> Sizes; @@ -2144,8 +2141,7 @@ void GPUNodeBuilder::prepareKernelArguments(ppcg_kernel *Kernel, Function *FN) { continue; isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set); - const ScopArrayInfo *SAI = - ScopArrayInfo::getFromId(isl::manage(isl_id_copy(Id))); + const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl::manage_copy(Id)); isl_id_free(Id); if (SAI->getNumberOfDimensions() > 0) { @@ -2178,8 +2174,7 @@ void GPUNodeBuilder::finalizeKernelArguments(ppcg_kernel *Kernel) { continue; isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set); - const ScopArrayInfo *SAI = - ScopArrayInfo::getFromId(isl::manage(isl_id_copy(Id))); + const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl::manage_copy(Id)); isl_id_free(Id); if (SAI->getNumberOfDimensions() > 0) { diff --git a/polly/lib/Support/ISLTools.cpp b/polly/lib/Support/ISLTools.cpp index ea1b30f07ee..41f9d4672bf 100644 --- a/polly/lib/Support/ISLTools.cpp +++ b/polly/lib/Support/ISLTools.cpp @@ -843,19 +843,19 @@ LLVM_DUMP_METHOD void polly::dumpPw(const isl::union_map &UMap) { } LLVM_DUMP_METHOD void polly::dumpPw(__isl_keep isl_set *Set) { - dumpPw(isl::manage(isl_set_copy(Set))); + dumpPw(isl::manage_copy(Set)); } LLVM_DUMP_METHOD void polly::dumpPw(__isl_keep isl_map *Map) { - dumpPw(isl::manage(isl_map_copy(Map))); + dumpPw(isl::manage_copy(Map)); } LLVM_DUMP_METHOD void polly::dumpPw(__isl_keep isl_union_set *USet) { - dumpPw(isl::manage(isl_union_set_copy(USet))); + dumpPw(isl::manage_copy(USet)); } LLVM_DUMP_METHOD void polly::dumpPw(__isl_keep isl_union_map *UMap) { - dumpPw(isl::manage(isl_union_map_copy(UMap))); + dumpPw(isl::manage_copy(UMap)); } LLVM_DUMP_METHOD void polly::dumpExpanded(const isl::set &Set) { @@ -875,18 +875,18 @@ LLVM_DUMP_METHOD void polly::dumpExpanded(const isl::union_map &UMap) { } LLVM_DUMP_METHOD void polly::dumpExpanded(__isl_keep isl_set *Set) { - dumpExpanded(isl::manage(isl_set_copy(Set))); + dumpExpanded(isl::manage_copy(Set)); } LLVM_DUMP_METHOD void polly::dumpExpanded(__isl_keep isl_map *Map) { - dumpExpanded(isl::manage(isl_map_copy(Map))); + dumpExpanded(isl::manage_copy(Map)); } LLVM_DUMP_METHOD void polly::dumpExpanded(__isl_keep isl_union_set *USet) { - dumpExpanded(isl::manage(isl_union_set_copy(USet))); + dumpExpanded(isl::manage_copy(USet)); } LLVM_DUMP_METHOD void polly::dumpExpanded(__isl_keep isl_union_map *UMap) { - dumpExpanded(isl::manage(isl_union_map_copy(UMap))); + dumpExpanded(isl::manage_copy(UMap)); } #endif diff --git a/polly/lib/Support/SCEVAffinator.cpp b/polly/lib/Support/SCEVAffinator.cpp index 5be900d0a8f..14603e1aad9 100644 --- a/polly/lib/Support/SCEVAffinator.cpp +++ b/polly/lib/Support/SCEVAffinator.cpp @@ -282,8 +282,7 @@ PWACtx SCEVAffinator::visitTruncateExpr(const SCEVTruncateExpr *Expr) { auto *SmallerDom = isl_pw_aff_lt_set(OpPWAC.first.copy(), isl_pw_aff_neg(ExpPWA)); auto *OutOfBoundsDom = isl_set_union(SmallerDom, GreaterDom); - OpPWAC.second = - OpPWAC.second.unite(isl::manage(isl_set_copy(OutOfBoundsDom))); + OpPWAC.second = OpPWAC.second.unite(isl::manage_copy(OutOfBoundsDom)); if (!BB) { assert(isl_set_dim(OutOfBoundsDom, isl_dim_set) == 0 && diff --git a/polly/lib/Transform/DeLICM.cpp b/polly/lib/Transform/DeLICM.cpp index 9709f426eae..5463eb019bd 100644 --- a/polly/lib/Transform/DeLICM.cpp +++ b/polly/lib/Transform/DeLICM.cpp @@ -484,8 +484,7 @@ public: // Does Proposed write at the same time as Existing already does (order of // writes is undefined)? Writing the same value is permitted. - auto ExistingWrittenDomain = - isl::manage(isl_union_map_domain(Existing.Written.copy())); + auto ExistingWrittenDomain = Existing.Written.domain(); auto BothWritten = Existing.Written.domain().intersect(Proposed.Written.domain()); auto ExistingKnownWritten = filterKnownValInst(Existing.Written); diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp index fa7e3921a65..7929a3d581b 100644 --- a/polly/lib/Transform/ScheduleOptimizer.cpp +++ b/polly/lib/Transform/ScheduleOptimizer.cpp @@ -1101,7 +1101,7 @@ optimizeDataLayoutMatrMulPattern(isl::schedule_node Node, isl::map MapOldIndVar, // matrix B, the second operand of the matrix multiplication. Node = Node.parent().parent().parent().parent().parent().parent(); Node = isl::manage(isl_schedule_node_band_split(Node.release(), 2)).child(0); - auto AccRel = getMatMulAccRel(isl::manage(MapOldIndVar.copy()), 3, 7); + auto AccRel = getMatMulAccRel(MapOldIndVar, 3, 7); unsigned FirstDimSize = MacroParams.Nc / MicroParams.Nr; unsigned SecondDimSize = MacroParams.Kc; unsigned ThirdDimSize = MicroParams.Nr; @@ -1122,15 +1122,15 @@ optimizeDataLayoutMatrMulPattern(isl::schedule_node Node, isl::map MapOldIndVar, auto DomainId = Domain.get_tuple_id(); auto *NewStmt = Stmt->getParent()->addScopStmt( OldAcc, MMI.B->getLatestAccessRelation(), Domain); - ExtMap = ExtMap.set_tuple_id(isl::dim::out, isl::manage(DomainId.copy())); - ExtMap = ExtMap.intersect_range(isl::manage(Domain.copy())); + ExtMap = ExtMap.set_tuple_id(isl::dim::out, DomainId); + ExtMap = ExtMap.intersect_range(Domain); ExtMap = ExtMap.set_tuple_id(isl::dim::out, NewStmt->getDomainId()); Node = createExtensionNode(Node, ExtMap); // Create a copy statement that corresponds to the memory access // to the matrix A, the first operand of the matrix multiplication. Node = Node.child(0); - AccRel = getMatMulAccRel(isl::manage(MapOldIndVar.copy()), 4, 6); + AccRel = getMatMulAccRel(MapOldIndVar, 4, 6); FirstDimSize = MacroParams.Mc / MicroParams.Mr; ThirdDimSize = MicroParams.Mr; SAI = Stmt->getParent()->createScopArrayInfo( @@ -1260,7 +1260,7 @@ getBandNodeWithOriginDimOrder(isl::schedule_node Node) { auto Domain = Node.get_universe_domain(); assert(isl_union_set_n_set(Domain.keep()) == 1); if (Node.get_schedule_depth() != 0 || - (isl::set(isl::manage(Domain.copy())).dim(isl::dim::set) != + (isl::set(Domain).dim(isl::dim::set) != isl_schedule_node_band_n_member(Node.keep()))) return Node; Node = isl::manage(isl_schedule_node_delete(Node.take())); @@ -1329,7 +1329,7 @@ bool ScheduleTreeOptimizer::isMatrMultPattern(isl::schedule_node Node, __isl_give isl_schedule_node * ScheduleTreeOptimizer::optimizeBand(__isl_take isl_schedule_node *Node, void *User) { - if (!isTileableBandNode(isl::manage(isl_schedule_node_copy(Node)))) + if (!isTileableBandNode(isl::manage_copy(Node))) return Node; const OptimizerAdditionalInfoTy *OAI = @@ -1337,8 +1337,7 @@ ScheduleTreeOptimizer::optimizeBand(__isl_take isl_schedule_node *Node, MatMulInfoTy MMI; if (PMBasedOpts && User && - isMatrMultPattern(isl::manage(isl_schedule_node_copy(Node)), OAI->D, - MMI)) { + isMatrMultPattern(isl::manage_copy(Node), OAI->D, MMI)) { DEBUG(dbgs() << "The matrix multiplication pattern was detected\n"); MatMulOpts++; return optimizeMatMulPattern(isl::manage(Node), OAI->TTI, MMI).release(); @@ -1434,7 +1433,7 @@ static void walkScheduleTreeForStatistics(isl::schedule Schedule, int Version) { isl_schedule_node_foreach_descendant_top_down( Root.get(), [](__isl_keep isl_schedule_node *nodeptr, void *user) -> isl_bool { - isl::schedule_node Node = isl::manage(isl_schedule_node_copy(nodeptr)); + isl::schedule_node Node = isl::manage_copy(nodeptr); int Version = *static_cast<int *>(user); switch (isl_schedule_node_get_type(Node.get())) { |