[polly] r325558 - Use isl::manage_copy to simplify calls to isl::manage(isl_.._copy())
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 19 23:26:58 PST 2018
Author: grosser
Date: Mon Feb 19 23:26:58 2018
New Revision: 325558
URL: http://llvm.org/viewvc/llvm-project?rev=325558&view=rev
Log:
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"
Modified:
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/CodeGen/BlockGenerators.cpp
polly/trunk/lib/CodeGen/IslAst.cpp
polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
polly/trunk/lib/Support/ISLTools.cpp
polly/trunk/lib/Support/SCEVAffinator.cpp
polly/trunk/lib/Transform/DeLICM.cpp
polly/trunk/lib/Transform/ScheduleOptimizer.cpp
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=325558&r1=325557&r2=325558&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Feb 19 23:26:58 2018
@@ -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);
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=325558&r1=325557&r2=325558&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Mon Feb 19 23:26:58 2018
@@ -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);
Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=325558&r1=325557&r2=325558&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Mon Feb 19 23:26:58 2018
@@ -439,14 +439,12 @@ IslAst::buildRunCondition(Scop &S, __isl
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 *cbPrintUs
__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 *cbPrintUs
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();
Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=325558&r1=325557&r2=325558&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Mon Feb 19 23:26:58 2018
@@ -540,8 +540,7 @@ void IslNodeBuilder::createForSequential
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(ScopSt
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
// 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();
}
Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=325558&r1=325557&r2=325558&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Mon Feb 19 23:26:58 2018
@@ -287,7 +287,7 @@ static __isl_give isl_id_to_ast_expr *po
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_
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(gp
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 *> GPUNodeBuil
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
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::prepareKernelArgume
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::finalizeKernelArgum
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) {
Modified: polly/trunk/lib/Support/ISLTools.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/ISLTools.cpp?rev=325558&r1=325557&r2=325558&view=diff
==============================================================================
--- polly/trunk/lib/Support/ISLTools.cpp (original)
+++ polly/trunk/lib/Support/ISLTools.cpp Mon Feb 19 23:26:58 2018
@@ -843,19 +843,19 @@ LLVM_DUMP_METHOD void polly::dumpPw(cons
}
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::dumpExpande
}
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
Modified: polly/trunk/lib/Support/SCEVAffinator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVAffinator.cpp?rev=325558&r1=325557&r2=325558&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVAffinator.cpp (original)
+++ polly/trunk/lib/Support/SCEVAffinator.cpp Mon Feb 19 23:26:58 2018
@@ -282,8 +282,7 @@ PWACtx SCEVAffinator::visitTruncateExpr(
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 &&
Modified: polly/trunk/lib/Transform/DeLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/DeLICM.cpp?rev=325558&r1=325557&r2=325558&view=diff
==============================================================================
--- polly/trunk/lib/Transform/DeLICM.cpp (original)
+++ polly/trunk/lib/Transform/DeLICM.cpp Mon Feb 19 23:26:58 2018
@@ -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);
Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=325558&r1=325557&r2=325558&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Mon Feb 19 23:26:58 2018
@@ -1101,7 +1101,7 @@ optimizeDataLayoutMatrMulPattern(isl::sc
// 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::sc
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::sched
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::isMatrMultPa
__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(__is
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 walkScheduleTreeForStatistic
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())) {
More information about the llvm-commits
mailing list