aboutsummaryrefslogtreecommitdiff
path: root/polly/include
diff options
context:
space:
mode:
authorMichael Kruse <llvm-project@meinersbur.de>2020-08-22 10:14:20 -0500
committerMichael Kruse <llvm-project@meinersbur.de>2020-08-22 10:14:20 -0500
commit8e06bf6b3a2e8d25e56cd52dca0cf3ff1b37b5d1 (patch)
treeb79276a96070f5a51d1debc199de5190df6dd978 /polly/include
parent6983741eaa84e76802feca9145e39293cc6d15b4 (diff)
downloadllvm-project-8e06bf6b3a2e8d25e56cd52dca0cf3ff1b37b5d1.tar.gz
[Polly] Ensure consistent Scop::InstStmtMap. NFC.
InstStmtMap became inconsistent with ScopStmt::getInstructions() after the statement's instructions is modified, e.g. by being considered unused by the Simplify pass or being moved by ForwardOpTree. Change ScopStmt::setInstructions() to also update its parent's InstStmtMap. Also add assertions checking the consistency.
Diffstat (limited to 'polly/include')
-rw-r--r--polly/include/polly/ScopInfo.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index b6fcddc6379a..7b6f13627826 100644
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -1539,9 +1539,7 @@ public:
/// Set the list of instructions for this statement. It replaces the current
/// list.
- void setInstructions(ArrayRef<Instruction *> Range) {
- Instructions.assign(Range.begin(), Range.end());
- }
+ void setInstructions(ArrayRef<Instruction *> Range);
std::vector<Instruction *>::const_iterator insts_begin() const {
return Instructions.begin();
@@ -1949,7 +1947,7 @@ private:
void addScopStmt(Region *R, StringRef Name, Loop *SurroundingLoop,
std::vector<Instruction *> EntryBlockInstructions);
- /// Removes @p Stmt from the StmtMap.
+ /// Removes @p Stmt from the StmtMap and InstStmtMap.
void removeFromStmtMap(ScopStmt &Stmt);
/// Removes all statements where the entry block of the statement does not
@@ -2362,6 +2360,12 @@ public:
return InstStmtMap.lookup(Inst);
}
+ /// Update the content of InstStmtMap for @p Stmt. @p OldList contains the
+ /// previous instructions in @p Stmt and is updated to contain the
+ /// instructions in @p NewList.
+ void updateInstStmtMap(ArrayRef<Instruction *> OldList,
+ ArrayRef<Instruction *> NewList, ScopStmt *Stmt);
+
/// Return the number of statements in the SCoP.
size_t getSize() const { return Stmts.size(); }