[polly] r338450 - [CodeGen] Convert IslNodeBuilder::createForSequential to isl++. NFC.
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 31 15:43:04 PDT 2018
Author: meinersbur
Date: Tue Jul 31 15:43:04 2018
New Revision: 338450
URL: http://llvm.org/viewvc/llvm-project?rev=338450&view=rev
Log:
[CodeGen] Convert IslNodeBuilder::createForSequential to isl++. NFC.
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=338450&r1=338449&r2=338450&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslNodeBuilder.h (original)
+++ polly/trunk/include/polly/CodeGen/IslNodeBuilder.h Tue Jul 31 15:43:04 2018
@@ -348,7 +348,7 @@ protected:
bool preloadInvariantEquivClass(InvariantEquivClassTy &IAClass);
void createForVector(__isl_take isl_ast_node *For, int VectorWidth);
- void createForSequential(__isl_take isl_ast_node *For, bool MarkParallel);
+ void createForSequential(isl::ast_node For, bool MarkParallel);
/// Create LLVM-IR that executes a for node thread parallel.
///
Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=338450&r1=338449&r2=338450&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Tue Jul 31 15:43:04 2018
@@ -422,7 +422,7 @@ void IslNodeBuilder::createMark(__isl_ta
if (Vector && 1 < VectorWidth && VectorWidth <= 16)
createForVector(Child, VectorWidth);
else
- createForSequential(Child, true);
+ createForSequential(isl::manage(Child), true);
isl_id_free(Id);
return;
}
@@ -515,20 +515,16 @@ static bool IsLoopVectorizerDisabled(isl
return false;
}
-void IslNodeBuilder::createForSequential(__isl_take isl_ast_node *For,
- bool MarkParallel) {
- isl_ast_node *Body;
- isl_ast_expr *Init, *Inc, *Iterator, *UB;
- isl_id *IteratorID;
+void IslNodeBuilder::createForSequential(isl::ast_node For, bool MarkParallel) {
Value *ValueLB, *ValueUB, *ValueInc;
Type *MaxType;
BasicBlock *ExitBlock;
Value *IV;
CmpInst::Predicate Predicate;
- bool LoopVectorizerDisabled = IsLoopVectorizerDisabled(isl::manage_copy(For));
+ bool LoopVectorizerDisabled = IsLoopVectorizerDisabled(For);
- Body = isl_ast_node_for_get_body(For);
+ isl::ast_node Body = For.for_get_body();
// isl_ast_node_for_is_degenerate(For)
//
@@ -536,17 +532,17 @@ void IslNodeBuilder::createForSequential
// However, for now we just reuse the logic for normal loops, which will
// create a loop with a single iteration.
- Init = isl_ast_node_for_get_init(For);
- Inc = isl_ast_node_for_get_inc(For);
- Iterator = isl_ast_node_for_get_iterator(For);
- IteratorID = isl_ast_expr_get_id(Iterator);
- UB = getUpperBound(isl::manage_copy(For), Predicate).release();
+ isl::ast_expr Init = For.for_get_init();
+ isl::ast_expr Inc = For.for_get_inc();
+ isl::ast_expr Iterator = For.for_get_iterator();
+ isl::id IteratorID = Iterator.get_id();
+ isl::ast_expr UB = getUpperBound(For, Predicate);
+
+ ValueLB = ExprBuilder.create(Init.release());
+ ValueUB = ExprBuilder.create(UB.release());
+ ValueInc = ExprBuilder.create(Inc.release());
- ValueLB = ExprBuilder.create(Init);
- ValueUB = ExprBuilder.create(UB);
- ValueInc = ExprBuilder.create(Inc);
-
- MaxType = ExprBuilder.getType(Iterator);
+ MaxType = ExprBuilder.getType(Iterator.get());
MaxType = ExprBuilder.getWidestType(MaxType, ValueLB->getType());
MaxType = ExprBuilder.getWidestType(MaxType, ValueUB->getType());
MaxType = ExprBuilder.getWidestType(MaxType, ValueInc->getType());
@@ -565,20 +561,16 @@ void IslNodeBuilder::createForSequential
IV = createLoop(ValueLB, ValueUB, ValueInc, Builder, LI, DT, ExitBlock,
Predicate, &Annotator, MarkParallel, UseGuardBB,
LoopVectorizerDisabled);
- IDToValue[IteratorID] = IV;
+ IDToValue[IteratorID.get()] = IV;
- create(Body);
+ create(Body.release());
Annotator.popLoop(MarkParallel);
- IDToValue.erase(IDToValue.find(IteratorID));
+ IDToValue.erase(IDToValue.find(IteratorID.get()));
Builder.SetInsertPoint(&ExitBlock->front());
- isl_ast_node_free(For);
- isl_ast_expr_free(Iterator);
- isl_id_free(IteratorID);
-
SequentialLoops++;
}
@@ -778,7 +770,7 @@ void IslNodeBuilder::createFor(__isl_tak
}
bool Parallel =
(IslAstInfo::isParallel(For) && !IslAstInfo::isReductionParallel(For));
- createForSequential(For, Parallel);
+ createForSequential(isl::manage(For), Parallel);
}
void IslNodeBuilder::createIf(__isl_take isl_ast_node *If) {
More information about the llvm-commits
mailing list