[polly] r260820 - Move AccFuncMap from ScopInfo into Scop
Hongbin Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 13 07:12:58 PST 2016
Author: ether
Date: Sat Feb 13 09:12:58 2016
New Revision: 260820
URL: http://llvm.org/viewvc/llvm-project?rev=260820&view=rev
Log:
Move AccFuncMap from ScopInfo into Scop
Since the origin AccFuncMap in ScopInfo is used by the underlying Scop
only, and it must stay alive until we delete the Scop. It will be better
if we simply move the origin AccFuncMap in ScopInfo into 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=260820&r1=260819&r2=260820&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Sat Feb 13 09:12:58 2016
@@ -1238,8 +1238,10 @@ private:
/// The underlying Region.
Region &R;
- // Access function of bbs.
- AccFuncMapType &AccFuncMap;
+ // Access function of statements (currently BasicBlocks) .
+ //
+ // This owns all the MemoryAccess objects of the Scop created in this pass.
+ AccFuncMapType AccFuncMap;
/// Flag to indicate that the scheduler actually optimized the SCoP.
bool IsOptimized;
@@ -1369,8 +1371,13 @@ private:
InvariantEquivClassesTy InvariantEquivClasses;
/// @brief Scop constructor; invoked from ScopInfo::buildScop.
- Scop(Region &R, AccFuncMapType &AccFuncMap, ScalarEvolution &SE, isl_ctx *ctx,
- unsigned MaxLoopDepth);
+ Scop(Region &R, ScalarEvolution &SE, isl_ctx *ctx, unsigned MaxLoopDepth);
+
+ /// @brief Get or create the access function set in a BasicBlock
+ AccFuncSetType &getOrCreateAccessFunctions(const BasicBlock *BB) {
+ return AccFuncMap[BB];
+ }
+ //@}
/// @brief Initialize this ScopInfo .
void init(AliasAnalysis &AA, AssumptionCache &AC, ScopDetection &SD,
@@ -2001,12 +2008,6 @@ class ScopInfo : public RegionPass {
/// @brief The ScalarEvolution to help building Scop.
ScalarEvolution *SE;
- // Access function of statements (currently BasicBlocks) .
- //
- // This owns all the MemoryAccess objects of the Scop created in this pass. It
- // must live until #scop is deleted.
- AccFuncMapType AccFuncMap;
-
// The Scop
Scop *scop;
isl_ctx *ctx;
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=260820&r1=260819&r2=260820&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sat Feb 13 09:12:58 2016
@@ -2731,10 +2731,9 @@ static unsigned getMaxLoopDepthInRegion(
return MaxLD - MinLD + 1;
}
-Scop::Scop(Region &R, AccFuncMapType &AccFuncMap,
- ScalarEvolution &ScalarEvolution, isl_ctx *Context,
+Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, isl_ctx *Context,
unsigned MaxLoopDepth)
- : SE(&ScalarEvolution), R(R), AccFuncMap(AccFuncMap), IsOptimized(false),
+ : SE(&ScalarEvolution), R(R), IsOptimized(false),
HasSingleExitEdge(R.getExitingBlock()), HasErrorBlock(false),
MaxLoopDepth(MaxLoopDepth), IslCtx(Context), Context(nullptr),
Affinator(this), AssumedContext(nullptr), BoundaryContext(nullptr),
@@ -3978,7 +3977,7 @@ MemoryAccess *ScopInfo::addMemoryAccess(
if (!Stmt)
return nullptr;
- AccFuncSetType &AccList = AccFuncMap[BB];
+ AccFuncSetType &AccList = scop->getOrCreateAccessFunctions(BB);
Value *BaseAddr = BaseAddress;
std::string BaseName = getIslCompatibleName("MemRef_", BaseAddr, "");
@@ -4127,7 +4126,7 @@ void ScopInfo::addPHIReadAccess(PHINode
void ScopInfo::buildScop(Region &R, AssumptionCache &AC) {
unsigned MaxLoopDepth = getMaxLoopDepthInRegion(R, *LI, *SD);
- scop = new Scop(R, AccFuncMap, *SE, ctx, MaxLoopDepth);
+ scop = new Scop(R, *SE, ctx, MaxLoopDepth);
buildStmts(R, R);
buildAccessFunctions(R, R);
@@ -4155,7 +4154,6 @@ void ScopInfo::print(raw_ostream &OS, co
}
void ScopInfo::clear() {
- AccFuncMap.clear();
if (scop) {
delete scop;
scop = 0;
More information about the llvm-commits
mailing list