[polly] r292168 - Tidy up getFirstNonBoxedLoopFor [NFC]
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 16 14:54:30 PST 2017
Author: efriedma
Date: Mon Jan 16 16:54:29 2017
New Revision: 292168
URL: http://llvm.org/viewvc/llvm-project?rev=292168&view=rev
Log:
Tidy up getFirstNonBoxedLoopFor [NFC]
Move the function getFirstNonBoxedLoopFor which is used in ScopBuilder
and in ScopInfo to Support/ScopHelpers to make it reusable in other
locations. No functionality change.
Patch by Sameer Abu Asal.
Differential Revision: https://reviews.llvm.org/D28754
Modified:
polly/trunk/include/polly/Support/ScopHelper.h
polly/trunk/lib/Analysis/ScopBuilder.cpp
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/Support/ScopHelper.cpp
Modified: polly/trunk/include/polly/Support/ScopHelper.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/ScopHelper.h?rev=292168&r1=292167&r2=292168&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/ScopHelper.h (original)
+++ polly/trunk/include/polly/Support/ScopHelper.h Mon Jan 16 16:54:29 2017
@@ -435,5 +435,24 @@ llvm::BasicBlock *getUseBlock(llvm::Use
std::tuple<std::vector<const llvm::SCEV *>, std::vector<int>>
getIndexExpressionsFromGEP(llvm::GetElementPtrInst *GEP,
llvm::ScalarEvolution &SE);
+
+// If the loop is nonaffine/boxed, return the first non-boxed surrounding loop
+// for Polly. If the loop is affine, return the loop itself.
+//
+// @param L Pointer to the Loop object to analyze.
+// @param LI Reference to the LoopInfo.
+// @param Boxed Loops Set of Boxed Loops we get from the SCoP.
+llvm::Loop *getFirstNonBoxedLoopFor(llvm::Loop *L, llvm::LoopInfo &LI,
+ const BoxedLoopsSetTy &BoxedLoops);
+
+// If the Basic Block belongs to a loop that is nonaffine/boxed, return the
+// first non-boxed surrounding loop for Polly. If the loop is affine, return
+// the loop itself.
+//
+// @param BB Pointer to the Basic Block to analyze.
+// @param LI Reference to the LoopInfo.
+// @param Boxed Loops Set of Boxed Loops we get from the SCoP.
+llvm::Loop *getFirstNonBoxedLoopFor(llvm::BasicBlock *BB, llvm::LoopInfo &LI,
+ const BoxedLoopsSetTy &BoxedLoops);
} // namespace polly
#endif
Modified: polly/trunk/lib/Analysis/ScopBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopBuilder.cpp?rev=292168&r1=292167&r2=292168&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopBuilder.cpp (original)
+++ polly/trunk/lib/Analysis/ScopBuilder.cpp Mon Jan 16 16:54:29 2017
@@ -31,17 +31,6 @@ STATISTIC(RichScopFound, "Number of Scop
STATISTIC(InfeasibleScops,
"Number of SCoPs with statically infeasible context.");
-// If the loop is nonaffine/boxed, return the first non-boxed surrounding loop
-// for Polly. If the loop is affine, return the loop itself. Do not call
-// `getSCEVAtScope()` on the result of `getFirstNonBoxedLoopFor()`, as we need
-// to analyze the memory accesses of the nonaffine/boxed loops.
-static Loop *getFirstNonBoxedLoopFor(Loop *L, LoopInfo &LI,
- const BoxedLoopsSetTy &BoxedLoops) {
- while (BoxedLoops.count(L))
- L = L->getParentLoop();
- return L;
-}
-
static cl::opt<bool> ModelReadOnlyScalars(
"polly-analyze-read-only-scalars",
cl::desc("Model read-only scalar values in the scop description"),
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=292168&r1=292167&r2=292168&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Jan 16 16:54:29 2017
@@ -2304,18 +2304,6 @@ bool Scop::buildDomains(Region *R, Domin
return true;
}
-// If the loop is nonaffine/boxed, return the first non-boxed surrounding loop
-// for Polly. If the loop is affine, return the loop itself. Do not call
-// `getSCEVAtScope()` on the result of `getFirstNonBoxedLoopFor()`, as we need
-// to analyze the memory accesses of the nonaffine/boxed loops.
-static Loop *getFirstNonBoxedLoopFor(BasicBlock *BB, LoopInfo &LI,
- const BoxedLoopsSetTy &BoxedLoops) {
- auto *L = LI.getLoopFor(BB);
- while (BoxedLoops.count(L))
- L = L->getParentLoop();
- return L;
-}
-
/// Adjust the dimensions of @p Dom that was constructed for @p OldL
/// to be compatible to domains constructed for loop @p NewL.
///
Modified: polly/trunk/lib/Support/ScopHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/ScopHelper.cpp?rev=292168&r1=292167&r2=292168&view=diff
==============================================================================
--- polly/trunk/lib/Support/ScopHelper.cpp (original)
+++ polly/trunk/lib/Support/ScopHelper.cpp Mon Jan 16 16:54:29 2017
@@ -571,3 +571,17 @@ polly::getIndexExpressionsFromGEP(GetEle
return std::make_tuple(Subscripts, Sizes);
}
+
+llvm::Loop *polly::getFirstNonBoxedLoopFor(llvm::Loop *L, llvm::LoopInfo &LI,
+ const BoxedLoopsSetTy &BoxedLoops) {
+ while (BoxedLoops.count(L))
+ L = L->getParentLoop();
+ return L;
+}
+
+llvm::Loop *polly::getFirstNonBoxedLoopFor(llvm::BasicBlock *BB,
+ llvm::LoopInfo &LI,
+ const BoxedLoopsSetTy &BoxedLoops) {
+ Loop *L = LI.getLoopFor(BB);
+ return getFirstNonBoxedLoopFor(L, LI, BoxedLoops);
+}
More information about the llvm-commits
mailing list