forked from OSchip/llvm-project
Simplify AccFuncMap to vector<> AccessFunctions
getAccessFunctions() is dead code and the 'BB' argument of getOrCreateAccessFunctions() is not used. This patch deletes getAccessFunctions and transforms AccFuncMap into a std::vector<std::unique_ptr<MemoryAccess>> AccessFunctions. Reviewed-by: Tobias Grosser <tobias@grosser.es> Differential Revision: https://reviews.llvm.org/D23759 llvm-svn: 279394
This commit is contained in:
parent
9ae797a798
commit
e2ee79afde
|
|
@ -91,8 +91,7 @@ enum AssumptionSign { AS_ASSUMPTION, AS_RESTRICTION };
|
||||||
/// through the loop.
|
/// through the loop.
|
||||||
typedef std::map<const Loop *, const SCEV *> LoopBoundMapType;
|
typedef std::map<const Loop *, const SCEV *> LoopBoundMapType;
|
||||||
|
|
||||||
typedef std::deque<MemoryAccess> AccFuncSetType;
|
typedef std::vector<std::unique_ptr<MemoryAccess>> AccFuncVector;
|
||||||
typedef std::map<const BasicBlock *, AccFuncSetType> AccFuncMapType;
|
|
||||||
|
|
||||||
/// @brief A class to store information about arrays in the SCoP.
|
/// @brief A class to store information about arrays in the SCoP.
|
||||||
///
|
///
|
||||||
|
|
@ -1348,10 +1347,10 @@ private:
|
||||||
/// The underlying Region.
|
/// The underlying Region.
|
||||||
Region &R;
|
Region &R;
|
||||||
|
|
||||||
// Access function of statements (currently BasicBlocks) .
|
// Access functions of the SCoP.
|
||||||
//
|
//
|
||||||
// This owns all the MemoryAccess objects of the Scop created in this pass.
|
// This owns all the MemoryAccess objects of the Scop created in this pass.
|
||||||
AccFuncMapType AccFuncMap;
|
AccFuncVector AccessFunctions;
|
||||||
|
|
||||||
/// Flag to indicate that the scheduler actually optimized the SCoP.
|
/// Flag to indicate that the scheduler actually optimized the SCoP.
|
||||||
bool IsOptimized;
|
bool IsOptimized;
|
||||||
|
|
@ -1532,9 +1531,10 @@ private:
|
||||||
Scop(Region &R, ScalarEvolution &SE, LoopInfo &LI,
|
Scop(Region &R, ScalarEvolution &SE, LoopInfo &LI,
|
||||||
ScopDetection::DetectionContext &DC);
|
ScopDetection::DetectionContext &DC);
|
||||||
|
|
||||||
/// @brief Get or create the access function set in a BasicBlock
|
/// @brief Add the access function to all MemoryAccess objects of the Scop
|
||||||
AccFuncSetType &getOrCreateAccessFunctions(const BasicBlock *BB) {
|
/// created in this pass.
|
||||||
return AccFuncMap[BB];
|
void addAccessFunction(MemoryAccess *Access) {
|
||||||
|
AccessFunctions.emplace_back(Access);
|
||||||
}
|
}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
@ -1844,17 +1844,6 @@ private:
|
||||||
public:
|
public:
|
||||||
~Scop();
|
~Scop();
|
||||||
|
|
||||||
/// @brief Get all access functions in a BasicBlock
|
|
||||||
///
|
|
||||||
/// @param BB The BasicBlock that containing the access functions.
|
|
||||||
///
|
|
||||||
/// @return All access functions in BB
|
|
||||||
///
|
|
||||||
AccFuncSetType *getAccessFunctions(const BasicBlock *BB) {
|
|
||||||
AccFuncMapType::iterator at = AccFuncMap.find(BB);
|
|
||||||
return at != AccFuncMap.end() ? &(at->second) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScalarEvolution *getSE() const;
|
ScalarEvolution *getSE() const;
|
||||||
|
|
||||||
/// @brief Get the count of parameters used in this Scop.
|
/// @brief Get the count of parameters used in this Scop.
|
||||||
|
|
|
||||||
|
|
@ -481,7 +481,6 @@ MemoryAccess *ScopBuilder::addMemoryAccess(
|
||||||
if (!Stmt)
|
if (!Stmt)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
AccFuncSetType &AccList = scop->getOrCreateAccessFunctions(BB);
|
|
||||||
Value *BaseAddr = BaseAddress;
|
Value *BaseAddr = BaseAddress;
|
||||||
std::string BaseName = getIslCompatibleName("MemRef_", BaseAddr, "");
|
std::string BaseName = getIslCompatibleName("MemRef_", BaseAddr, "");
|
||||||
|
|
||||||
|
|
@ -509,10 +508,13 @@ MemoryAccess *ScopBuilder::addMemoryAccess(
|
||||||
if (!isKnownMustAccess && AccType == MemoryAccess::MUST_WRITE)
|
if (!isKnownMustAccess && AccType == MemoryAccess::MUST_WRITE)
|
||||||
AccType = MemoryAccess::MAY_WRITE;
|
AccType = MemoryAccess::MAY_WRITE;
|
||||||
|
|
||||||
AccList.emplace_back(Stmt, Inst, AccType, BaseAddress, ElementType, Affine,
|
auto *Access =
|
||||||
|
new MemoryAccess(Stmt, Inst, AccType, BaseAddress, ElementType, Affine,
|
||||||
Subscripts, Sizes, AccessValue, Kind, BaseName);
|
Subscripts, Sizes, AccessValue, Kind, BaseName);
|
||||||
Stmt->addAccess(&AccList.back());
|
|
||||||
return &AccList.back();
|
scop->addAccessFunction(Access);
|
||||||
|
Stmt->addAccess(Access);
|
||||||
|
return Access;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScopBuilder::addArrayAccess(
|
void ScopBuilder::addArrayAccess(
|
||||||
|
|
|
||||||
|
|
@ -3144,7 +3144,7 @@ Scop::~Scop() {
|
||||||
ScopArrayInfoSet.clear();
|
ScopArrayInfoSet.clear();
|
||||||
ScopArrayInfoMap.clear();
|
ScopArrayInfoMap.clear();
|
||||||
ScopArrayNameMap.clear();
|
ScopArrayNameMap.clear();
|
||||||
AccFuncMap.clear();
|
AccessFunctions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scop::updateAccessDimensionality() {
|
void Scop::updateAccessDimensionality() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue