[polly] r249125 - [NFC] Make the ScopDetection analysis a member of the Scop class
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 06:09:31 PDT 2015
Author: jdoerfert
Date: Fri Oct 2 08:09:31 2015
New Revision: 249125
URL: http://llvm.org/viewvc/llvm-project?rev=249125&view=rev
Log:
[NFC] Make the ScopDetection analysis a member of the Scop class
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=249125&r1=249124&r2=249125&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Fri Oct 2 08:09:31 2015
@@ -1027,6 +1027,9 @@ private:
DominatorTree &DT;
ScalarEvolution *SE;
+ /// @brief The scop detection analysis.
+ ScopDetection &SD;
+
/// The underlying Region.
Region &R;
@@ -1153,11 +1156,12 @@ private:
InvariantAccessesTy InvariantAccesses;
/// @brief Scop constructor; invoked from ScopInfo::buildScop.
- Scop(Region &R, AccFuncMapType &AccFuncMap, ScalarEvolution &SE,
- DominatorTree &DT, isl_ctx *ctx, unsigned MaxLoopDepth);
+ Scop(Region &R, AccFuncMapType &AccFuncMap, ScopDetection &SD,
+ ScalarEvolution &SE, DominatorTree &DT, isl_ctx *ctx,
+ unsigned MaxLoopDepth);
/// @brief Initialize this ScopInfo .
- void init(LoopInfo &LI, ScopDetection &SD, AliasAnalysis &AA);
+ void init(LoopInfo &LI, AliasAnalysis &AA);
/// @brief Add loop carried constraints to the header block of the loop @p L.
///
@@ -1169,28 +1173,23 @@ private:
///
/// @param R The region we currently build branching conditions for.
/// @param LI The LoopInfo analysis to obtain the number of iterators.
- /// @param SD The ScopDetection analysis to identify non-affine sub-regions.
/// @param DT The dominator tree of the current function.
void buildDomainsWithBranchConstraints(Region *R, LoopInfo &LI,
- ScopDetection &SD, DominatorTree &DT);
+ DominatorTree &DT);
/// @brief Propagate the domain constraints through the region @p R.
///
/// @param R The region we currently build branching conditions for.
/// @param LI The LoopInfo analysis to obtain the number of iterators.
- /// @param SD The ScopDetection analysis to identify non-affine sub-regions.
/// @param DT The dominator tree of the current function.
- void propagateDomainConstraints(Region *R, LoopInfo &LI, ScopDetection &SD,
- DominatorTree &DT);
+ void propagateDomainConstraints(Region *R, LoopInfo &LI, DominatorTree &DT);
/// @brief Compute the domain for each basic block in @p R.
///
/// @param R The region we currently traverse.
/// @param LI The LoopInfo analysis to argue about the number of iterators.
- /// @param SD The ScopDetection analysis to identify non-affine sub-regions.
/// @param DT The dominator tree of the current function.
- void buildDomains(Region *R, LoopInfo &LI, ScopDetection &SD,
- DominatorTree &DT);
+ void buildDomains(Region *R, LoopInfo &LI, DominatorTree &DT);
/// @brief Check if a region part should be represented in the SCoP or not.
///
@@ -1251,10 +1250,9 @@ private:
///
/// @param R The current region traversed.
/// @param LI The LoopInfo object.
- /// @param SD The ScopDetection object.
/// @param LoopSchedules Map from loops to their schedule and progress.
void buildSchedule(
- Region *R, LoopInfo &LI, ScopDetection &SD,
+ Region *R, LoopInfo &LI,
DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> &LoopSchedules);
/// @name Helper function for printing the Scop.
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=249125&r1=249124&r2=249125&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Oct 2 08:09:31 2015
@@ -1723,8 +1723,7 @@ isl_set *Scop::getDomainConditions(Basic
return isl_set_copy(DomainMap[BB]);
}
-void Scop::buildDomains(Region *R, LoopInfo &LI, ScopDetection &SD,
- DominatorTree &DT) {
+void Scop::buildDomains(Region *R, LoopInfo &LI, DominatorTree &DT) {
auto *EntryBB = R->getEntry();
int LD = getRelativeLoopDepth(LI.getLoopFor(EntryBB));
@@ -1741,12 +1740,11 @@ void Scop::buildDomains(Region *R, LoopI
if (SD.isNonAffineSubRegion(R, R))
return;
- buildDomainsWithBranchConstraints(R, LI, SD, DT);
- propagateDomainConstraints(R, LI, SD, DT);
+ buildDomainsWithBranchConstraints(R, LI, DT);
+ propagateDomainConstraints(R, LI, DT);
}
void Scop::buildDomainsWithBranchConstraints(Region *R, LoopInfo &LI,
- ScopDetection &SD,
DominatorTree &DT) {
RegionInfo &RI = *R->getRegionInfo();
@@ -1769,7 +1767,7 @@ void Scop::buildDomainsWithBranchConstra
if (RN->isSubRegion()) {
Region *SubRegion = RN->getNodeAs<Region>();
if (!SD.isNonAffineSubRegion(SubRegion, &getRegion())) {
- buildDomainsWithBranchConstraints(SubRegion, LI, SD, DT);
+ buildDomainsWithBranchConstraints(SubRegion, LI, DT);
continue;
}
}
@@ -1890,7 +1888,7 @@ getDomainForBlock(BasicBlock *BB, DenseM
}
void Scop::propagateDomainConstraints(Region *R, LoopInfo &LI,
- ScopDetection &SD, DominatorTree &DT) {
+ DominatorTree &DT) {
// Iterate over the region R and propagate the domain constrains from the
// predecessors to the current node. In contrast to the
// buildDomainsWithBranchConstraints function, this one will pull the domain
@@ -1911,7 +1909,7 @@ void Scop::propagateDomainConstraints(Re
if (RN->isSubRegion()) {
Region *SubRegion = RN->getNodeAs<Region>();
if (!SD.isNonAffineSubRegion(SubRegion, &getRegion())) {
- propagateDomainConstraints(SubRegion, LI, SD, DT);
+ propagateDomainConstraints(SubRegion, LI, DT);
continue;
}
}
@@ -2302,24 +2300,24 @@ static unsigned getMaxLoopDepthInRegion(
return MaxLD - MinLD + 1;
}
-Scop::Scop(Region &R, AccFuncMapType &AccFuncMap,
+Scop::Scop(Region &R, AccFuncMapType &AccFuncMap, ScopDetection &SD,
ScalarEvolution &ScalarEvolution, DominatorTree &DT,
isl_ctx *Context, unsigned MaxLoopDepth)
- : DT(DT), SE(&ScalarEvolution), R(R), AccFuncMap(AccFuncMap),
+ : DT(DT), SE(&ScalarEvolution), SD(SD), R(R), AccFuncMap(AccFuncMap),
IsOptimized(false), HasSingleExitEdge(R.getExitingBlock()),
MaxLoopDepth(MaxLoopDepth), IslCtx(Context), Affinator(this),
BoundaryContext(nullptr) {}
-void Scop::init(LoopInfo &LI, ScopDetection &SD, AliasAnalysis &AA) {
+void Scop::init(LoopInfo &LI, AliasAnalysis &AA) {
buildContext();
- buildDomains(&R, LI, SD, DT);
+ buildDomains(&R, LI, DT);
DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> LoopSchedules;
Loop *L = getLoopSurroundingRegion(R, LI);
LoopSchedules[L];
- buildSchedule(&R, LI, SD, LoopSchedules);
+ buildSchedule(&R, LI, LoopSchedules);
updateAccessDimensionality();
Schedule = LoopSchedules[L].first;
@@ -2872,7 +2870,7 @@ ScopStmt *Scop::addScopStmt(BasicBlock *
}
void Scop::buildSchedule(
- Region *R, LoopInfo &LI, ScopDetection &SD,
+ Region *R, LoopInfo &LI,
DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> &LoopSchedules) {
if (SD.isNonAffineSubRegion(R, &getRegion())) {
@@ -2891,7 +2889,7 @@ void Scop::buildSchedule(
if (RN->isSubRegion()) {
Region *SubRegion = RN->getNodeAs<Region>();
if (!SD.isNonAffineSubRegion(SubRegion, &getRegion())) {
- buildSchedule(SubRegion, LI, SD, LoopSchedules);
+ buildSchedule(SubRegion, LI, LoopSchedules);
continue;
}
}
@@ -3291,7 +3289,7 @@ void ScopInfo::addPHIReadAccess(PHINode
void ScopInfo::buildScop(Region &R, DominatorTree &DT) {
unsigned MaxLoopDepth = getMaxLoopDepthInRegion(R, *LI, *SD);
- scop = new Scop(R, AccFuncMap, *SE, DT, ctx, MaxLoopDepth);
+ scop = new Scop(R, AccFuncMap, *SD, *SE, DT, ctx, MaxLoopDepth);
buildAccessFunctions(R, R);
@@ -3305,7 +3303,7 @@ void ScopInfo::buildScop(Region &R, Domi
if (!R.getExitingBlock())
buildAccessFunctions(R, *R.getExit(), nullptr, /* IsExitBlock */ true);
- scop->init(*LI, *SD, *AA);
+ scop->init(*LI, *AA);
}
void ScopInfo::print(raw_ostream &OS, const Module *) const {
More information about the llvm-commits
mailing list