summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2016-05-23 14:45:58 +0000
committerMichael Kruse <llvm@meinersbur.de>2016-05-23 14:45:58 +0000
commit1007182cf7a3fbe15213b54f72b274bf477cd994 (patch)
tree885e53ff6d0590c72e20ce6b291246d2131f8d7a
parentd32e4c9f0d6fb8a7884d84e5c2c669f2b73b8f9f (diff)
downloadbcm5719-llvm-1007182cf7a3fbe15213b54f72b274bf477cd994.tar.gz
bcm5719-llvm-1007182cf7a3fbe15213b54f72b274bf477cd994.zip
[ScopInfo] Change removeMemoryAccesses to remove only one access. NFC.
This exposes the more basic operation for use by code not related to invariant code hoisting. llvm-svn: 270438
-rw-r--r--polly/include/polly/ScopInfo.h6
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp24
2 files changed, 14 insertions, 16 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index b19b3024e91..debbe8332e6 100644
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -1231,11 +1231,11 @@ public:
/// @brief Add @p Access to this statement's list of accesses.
void addAccess(MemoryAccess *Access);
- /// @brief Remove the memory access in @p InvMAs.
+ /// @brief Remove a MemoryAccess from this statement.
///
- /// Note that scalar accesses that are caused by any access in @p InvMAs will
+ /// Note that scalar accesses that are caused by MA will
/// be eliminated too.
- void removeMemoryAccesses(InvariantAccessesTy &InvMAs);
+ void removeMemoryAccess(MemoryAccess *MA);
typedef MemoryAccessVec::iterator iterator;
typedef MemoryAccessVec::const_iterator const_iterator;
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 7e3d34e648a..155e068c518 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -1706,22 +1706,19 @@ void ScopStmt::print(raw_ostream &OS) const {
void ScopStmt::dump() const { print(dbgs()); }
-void ScopStmt::removeMemoryAccesses(InvariantAccessesTy &InvMAs) {
- // Remove all memory accesses in @p InvMAs from this statement
- // together with all scalar accesses that were caused by them.
+void ScopStmt::removeMemoryAccess(MemoryAccess *MA) {
+ // Remove the memory accesses from this statement
+ // together with all scalar accesses that were caused by it.
// MK_Value READs have no access instruction, hence would not be removed by
// this function. However, it is only used for invariant LoadInst accesses,
// its arguments are always affine, hence synthesizable, and therefore there
// are no MK_Value READ accesses to be removed.
- for (const auto &InvMA : InvMAs) {
- auto *MA = InvMA.MA;
- auto Predicate = [&](MemoryAccess *Acc) {
- return Acc->getAccessInstruction() == MA->getAccessInstruction();
- };
- MemAccs.erase(std::remove_if(MemAccs.begin(), MemAccs.end(), Predicate),
- MemAccs.end());
- InstructionToAccess.erase(MA->getAccessInstruction());
- }
+ auto Predicate = [&](MemoryAccess *Acc) {
+ return Acc->getAccessInstruction() == MA->getAccessInstruction();
+ };
+ MemAccs.erase(std::remove_if(MemAccs.begin(), MemAccs.end(), Predicate),
+ MemAccs.end());
+ InstructionToAccess.erase(MA->getAccessInstruction());
}
//===----------------------------------------------------------------------===//
@@ -3526,7 +3523,8 @@ void Scop::hoistInvariantLoads() {
InvariantAccesses.push_back({Access, NHCtx});
// Transfer the memory access from the statement to the SCoP.
- Stmt.removeMemoryAccesses(InvariantAccesses);
+ for (auto InvMA : InvariantAccesses)
+ Stmt.removeMemoryAccess(InvMA.MA);
addInvariantLoads(Stmt, InvariantAccesses);
}
isl_union_map_free(Writes);
OpenPOWER on IntegriCloud