[polly] r264781 - Factor out "getFirstNonBoxedLoopFor" function [NFC]
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 29 13:32:43 PDT 2016
Author: jdoerfert
Date: Tue Mar 29 15:32:43 2016
New Revision: 264781
URL: http://llvm.org/viewvc/llvm-project?rev=264781&view=rev
Log:
Factor out "getFirstNonBoxedLoopFor" function [NFC]
Modified:
polly/trunk/lib/Analysis/ScopInfo.cpp
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=264781&r1=264780&r2=264781&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Tue Mar 29 15:32:43 2016
@@ -2179,6 +2179,15 @@ bool Scop::buildDomains(Region *R, ScopD
return true;
}
+static Loop *
+getFirstNonBoxedLoopFor(BasicBlock *BB, LoopInfo &LI,
+ const ScopDetection::BoxedLoopsSetTy &BoxedLoops) {
+ auto *L = LI.getLoopFor(BB);
+ while (BoxedLoops.count(L))
+ L = L->getParentLoop();
+ return L;
+}
+
bool Scop::buildDomainsWithBranchConstraints(Region *R, ScopDetection &SD,
DominatorTree &DT, LoopInfo &LI) {
auto &BoxedLoops = *SD.getBoxedLoops(&getRegion());
@@ -2251,9 +2260,7 @@ bool Scop::buildDomainsWithBranchConstra
// Do not adjust the number of dimensions if we enter a boxed loop or are
// in a non-affine subregion or if the surrounding loop stays the same.
- Loop *SuccBBLoop = LI.getLoopFor(SuccBB);
- while (BoxedLoops.count(SuccBBLoop))
- SuccBBLoop = SuccBBLoop->getParentLoop();
+ auto *SuccBBLoop = getFirstNonBoxedLoopFor(SuccBB, LI, BoxedLoops);
if (BBLoop != SuccBBLoop) {
@@ -2389,9 +2396,7 @@ void Scop::propagateDomainConstraints(Re
// predecessor and the current block are surrounded by different
// loops in the same depth.
PredBBDom = getDomainForBlock(PredBB, DomainMap, *R->getRegionInfo());
- Loop *PredBBLoop = LI.getLoopFor(PredBB);
- while (BoxedLoops.count(PredBBLoop))
- PredBBLoop = PredBBLoop->getParentLoop();
+ auto *PredBBLoop = getFirstNonBoxedLoopFor(PredBB, LI, BoxedLoops);
int PredBBLoopDepth = getRelativeLoopDepth(PredBBLoop);
unsigned LoopDepthDiff = std::abs(BBLoopDepth - PredBBLoopDepth);
More information about the llvm-commits
mailing list