diff options
author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-01-06 12:59:23 +0000 |
---|---|---|
committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-01-06 12:59:23 +0000 |
commit | f9711ef922df4558be18988788680faf55b60641 (patch) | |
tree | 0a30dd7692f07ec7ae254bb79513930328e94a85 | |
parent | bf894faa15a5802c914688112db62a112622d8d1 (diff) | |
download | bcm5719-llvm-f9711ef922df4558be18988788680faf55b60641.tar.gz bcm5719-llvm-f9711ef922df4558be18988788680faf55b60641.zip |
Extract constant parts of the schedule generation [NFC]
llvm-svn: 256931
-rw-r--r-- | polly/include/polly/ScopInfo.h | 6 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 33 |
2 files changed, 23 insertions, 16 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index 0252599afa2..b5a17aa1dde 100644 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -1404,7 +1404,11 @@ private: /// the dimensionality of the underlying ScopArrayInfo object. void updateAccessDimensionality(); - /// @brief Build Schedule and ScopStmts. + /// @brief Build Schedule for the SCoP region. + /// + void buildSchedule(); + + /// @brief Build Schedule for the region @p R. /// /// @param R The current region traversed. /// @param LoopSchedules Map from loops to their schedule and progress. diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 6cad1bcfd74..f1d42fbf610 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -2676,11 +2676,7 @@ void Scop::init(AliasAnalysis &AA, AssumptionCache &AC) { for (ScopStmt &Stmt : Stmts) Stmt.init(); - DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> LoopSchedules; - Loop *L = getLoopSurroundingRegion(R, LI); - LoopSchedules[L]; - buildSchedule(&R, LoopSchedules); - Schedule = LoopSchedules[L].first; + buildSchedule(); if (isl_set_is_empty(AssumedContext)) return; @@ -3431,21 +3427,28 @@ void Scop::addScopStmt(BasicBlock *BB, Region *R) { } } -void Scop::buildSchedule( - Region *R, - DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> &LoopSchedules) { +void Scop::buildSchedule() { - if (SD.isNonAffineSubRegion(R, &getRegion())) { - Loop *L = getLoopSurroundingRegion(*R, LI); - auto &LSchedulePair = LoopSchedules[L]; - ScopStmt *Stmt = getStmtForBasicBlock(R->getEntry()); + // Special case for SCoPs that consist only of one non-affine region. + if (SD.isNonAffineSubRegion(&getRegion(), &getRegion())) { + ScopStmt *Stmt = getStmtForBasicBlock(getRegion().getEntry()); isl_set *Domain = Stmt->getDomain(); - auto *UDomain = isl_union_set_from_set(Domain); - auto *StmtSchedule = isl_schedule_from_domain(UDomain); - LSchedulePair.first = StmtSchedule; + Schedule = isl_schedule_from_domain(isl_union_set_from_set(Domain)); return; } + // For general SCoPs invoke the recursive schedule generation. + DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> LoopSchedules; + Loop *L = getLoopSurroundingRegion(getRegion(), LI); + LoopSchedules[L]; + buildSchedule(&getRegion(), LoopSchedules); + Schedule = LoopSchedules[L].first; +} + +void Scop::buildSchedule( + Region *R, + DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> &LoopSchedules) { + ReversePostOrderTraversal<Region *> RTraversal(R); for (auto *RN : RTraversal) { |