[polly] r270052 - Compute the MaxLoopDepth during domain construction [NFC]
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu May 19 05:33:14 PDT 2016
Author: jdoerfert
Date: Thu May 19 07:33:14 2016
New Revision: 270052
URL: http://llvm.org/viewvc/llvm-project?rev=270052&view=rev
Log:
Compute the MaxLoopDepth during domain construction [NFC]
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/test/ScopInfo/avoid_new_parameters_from_geps.ll
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=270052&r1=270051&r2=270052&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Thu May 19 07:33:14 2016
@@ -1493,7 +1493,7 @@ private:
InvariantEquivClassesTy InvariantEquivClasses;
/// @brief Scop constructor; invoked from ScopInfo::buildScop.
- Scop(Region &R, ScalarEvolution &SE, LoopInfo &LI, unsigned MaxLoopDepth);
+ Scop(Region &R, ScalarEvolution &SE, LoopInfo &LI);
/// @brief Get or create the access function set in a BasicBlock
AccFuncSetType &getOrCreateAccessFunctions(const BasicBlock *BB) {
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=270052&r1=270051&r2=270052&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu May 19 07:33:14 2016
@@ -2548,6 +2548,7 @@ bool Scop::buildDomainsWithBranchConstra
isl_set *Domain = DomainMap.lookup(BB);
if (!Domain)
continue;
+ MaxLoopDepth = std::max(MaxLoopDepth, isl_set_n_dim(Domain));
auto *BBLoop = getRegionNodeLoop(RN, LI);
// Propagate the domain from BB directly to blocks that have a superset
@@ -3057,41 +3058,12 @@ static Loop *getLoopSurroundingRegion(Re
return L ? (R.contains(L) ? L->getParentLoop() : L) : nullptr;
}
-static unsigned getMaxLoopDepthInRegion(const Region &R, LoopInfo &LI,
- ScopDetection &SD) {
-
- const ScopDetection::BoxedLoopsSetTy *BoxedLoops = SD.getBoxedLoops(&R);
-
- unsigned MinLD = INT_MAX, MaxLD = 0;
- for (BasicBlock *BB : R.blocks()) {
- if (Loop *L = LI.getLoopFor(BB)) {
- if (!R.contains(L))
- continue;
- if (BoxedLoops && BoxedLoops->count(L))
- continue;
- unsigned LD = L->getLoopDepth();
- MinLD = std::min(MinLD, LD);
- MaxLD = std::max(MaxLD, LD);
- }
- }
-
- // Handle the case that there is no loop in the SCoP first.
- if (MaxLD == 0)
- return 1;
-
- assert(MinLD >= 1 && "Minimal loop depth should be at least one");
- assert(MaxLD >= MinLD &&
- "Maximal loop depth was smaller than mininaml loop depth?");
- return MaxLD - MinLD + 1;
-}
-
-Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, LoopInfo &LI,
- unsigned MaxLoopDepth)
+Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, LoopInfo &LI)
: SE(&ScalarEvolution), R(R), IsOptimized(false),
HasSingleExitEdge(R.getExitingBlock()), HasErrorBlock(false),
- MaxLoopDepth(MaxLoopDepth), IslCtx(isl_ctx_alloc(), isl_ctx_free),
- Context(nullptr), Affinator(this, LI), AssumedContext(nullptr),
- InvalidContext(nullptr), Schedule(nullptr) {
+ MaxLoopDepth(0), IslCtx(isl_ctx_alloc(), isl_ctx_free), Context(nullptr),
+ Affinator(this, LI), AssumedContext(nullptr), InvalidContext(nullptr),
+ Schedule(nullptr) {
if (IslOnErrorAbort)
isl_options_set_on_error(getIslCtx(), ISL_ON_ERROR_ABORT);
buildContext();
@@ -4838,8 +4810,7 @@ void ScopInfo::addPHIReadAccess(PHINode
}
void ScopInfo::buildScop(Region &R, AssumptionCache &AC) {
- unsigned MaxLoopDepth = getMaxLoopDepthInRegion(R, *LI, *SD);
- scop.reset(new Scop(R, *SE, *LI, MaxLoopDepth));
+ scop.reset(new Scop(R, *SE, *LI));
buildStmts(R, R);
buildAccessFunctions(R, R, *SD->getInsnToMemAccMap(&R));
Modified: polly/trunk/test/ScopInfo/avoid_new_parameters_from_geps.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/avoid_new_parameters_from_geps.ll?rev=270052&r1=270051&r2=270052&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/avoid_new_parameters_from_geps.ll (original)
+++ polly/trunk/test/ScopInfo/avoid_new_parameters_from_geps.ll Thu May 19 07:33:14 2016
@@ -3,7 +3,7 @@
; Check that we do no introduce a parameter here that is actually not needed.
;
; CHECK: Region: %for.body58---%land.lhs.true
-; CHECK-NEXT: Max Loop Depth: 1
+; CHECK-NEXT: Max Loop Depth: 0
; CHECK-NEXT: Invariant Accesses: {
; CHECK-NEXT: }
; CHECK-NEXT: Context:
More information about the llvm-commits
mailing list