forked from OSchip/llvm-project
Revert "[Polly] Ensure consistent Scop::InstStmtMap. NFC."
This reverts commit 8e06bf6b3a
.
It broke the polly-x86_64-linux-test-suite and
aosp-O3-polly-before-vectorizer-unprofitable buildbots.
This commit is contained in:
parent
54f5a4ea4c
commit
8b14db636d
|
@ -1539,7 +1539,9 @@ public:
|
||||||
|
|
||||||
/// Set the list of instructions for this statement. It replaces the current
|
/// Set the list of instructions for this statement. It replaces the current
|
||||||
/// list.
|
/// list.
|
||||||
void setInstructions(ArrayRef<Instruction *> Range);
|
void setInstructions(ArrayRef<Instruction *> Range) {
|
||||||
|
Instructions.assign(Range.begin(), Range.end());
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<Instruction *>::const_iterator insts_begin() const {
|
std::vector<Instruction *>::const_iterator insts_begin() const {
|
||||||
return Instructions.begin();
|
return Instructions.begin();
|
||||||
|
@ -1947,7 +1949,7 @@ private:
|
||||||
void addScopStmt(Region *R, StringRef Name, Loop *SurroundingLoop,
|
void addScopStmt(Region *R, StringRef Name, Loop *SurroundingLoop,
|
||||||
std::vector<Instruction *> EntryBlockInstructions);
|
std::vector<Instruction *> EntryBlockInstructions);
|
||||||
|
|
||||||
/// Removes @p Stmt from the StmtMap and InstStmtMap.
|
/// Removes @p Stmt from the StmtMap.
|
||||||
void removeFromStmtMap(ScopStmt &Stmt);
|
void removeFromStmtMap(ScopStmt &Stmt);
|
||||||
|
|
||||||
/// Removes all statements where the entry block of the statement does not
|
/// Removes all statements where the entry block of the statement does not
|
||||||
|
@ -2360,12 +2362,6 @@ public:
|
||||||
return InstStmtMap.lookup(Inst);
|
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.
|
/// Return the number of statements in the SCoP.
|
||||||
size_t getSize() const { return Stmts.size(); }
|
size_t getSize() const { return Stmts.size(); }
|
||||||
|
|
||||||
|
|
|
@ -1249,11 +1249,6 @@ BasicBlock *ScopStmt::getEntryBlock() const {
|
||||||
|
|
||||||
unsigned ScopStmt::getNumIterators() const { return NestLoops.size(); }
|
unsigned ScopStmt::getNumIterators() const { return NestLoops.size(); }
|
||||||
|
|
||||||
void ScopStmt::setInstructions(ArrayRef<Instruction *> Range) {
|
|
||||||
getParent()->updateInstStmtMap(Instructions, Range, this);
|
|
||||||
Instructions.assign(Range.begin(), Range.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *ScopStmt::getBaseName() const { return BaseName.c_str(); }
|
const char *ScopStmt::getBaseName() const { return BaseName.c_str(); }
|
||||||
|
|
||||||
Loop *ScopStmt::getLoopForDimension(unsigned Dimension) const {
|
Loop *ScopStmt::getLoopForDimension(unsigned Dimension) const {
|
||||||
|
@ -1733,10 +1728,8 @@ Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, LoopInfo &LI,
|
||||||
Scop::~Scop() = default;
|
Scop::~Scop() = default;
|
||||||
|
|
||||||
void Scop::removeFromStmtMap(ScopStmt &Stmt) {
|
void Scop::removeFromStmtMap(ScopStmt &Stmt) {
|
||||||
for (Instruction *Inst : Stmt.getInstructions()) {
|
for (Instruction *Inst : Stmt.getInstructions())
|
||||||
assert(!InstStmtMap.count(Inst) || InstStmtMap.lookup(Inst) == &Stmt);
|
|
||||||
InstStmtMap.erase(Inst);
|
InstStmtMap.erase(Inst);
|
||||||
}
|
|
||||||
|
|
||||||
if (Stmt.isRegionStmt()) {
|
if (Stmt.isRegionStmt()) {
|
||||||
for (BasicBlock *BB : Stmt.getRegion()->blocks()) {
|
for (BasicBlock *BB : Stmt.getRegion()->blocks()) {
|
||||||
|
@ -1745,10 +1738,8 @@ void Scop::removeFromStmtMap(ScopStmt &Stmt) {
|
||||||
// part of the statement's instruction list.
|
// part of the statement's instruction list.
|
||||||
if (BB == Stmt.getEntryBlock())
|
if (BB == Stmt.getEntryBlock())
|
||||||
continue;
|
continue;
|
||||||
for (Instruction &Inst : *BB) {
|
for (Instruction &Inst : *BB)
|
||||||
assert(!InstStmtMap.count(&Inst) || InstStmtMap.lookup(&Inst) == &Stmt);
|
|
||||||
InstStmtMap.erase(&Inst);
|
InstStmtMap.erase(&Inst);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto StmtMapIt = StmtMap.find(Stmt.getBasicBlock());
|
auto StmtMapIt = StmtMap.find(Stmt.getBasicBlock());
|
||||||
|
@ -1756,16 +1747,9 @@ void Scop::removeFromStmtMap(ScopStmt &Stmt) {
|
||||||
StmtMapIt->second.erase(std::remove(StmtMapIt->second.begin(),
|
StmtMapIt->second.erase(std::remove(StmtMapIt->second.begin(),
|
||||||
StmtMapIt->second.end(), &Stmt),
|
StmtMapIt->second.end(), &Stmt),
|
||||||
StmtMapIt->second.end());
|
StmtMapIt->second.end());
|
||||||
for (Instruction *Inst : Stmt.getInstructions()) {
|
for (Instruction *Inst : Stmt.getInstructions())
|
||||||
assert(!InstStmtMap.count(Inst) || InstStmtMap.lookup(Inst) == &Stmt);
|
|
||||||
InstStmtMap.erase(Inst);
|
InstStmtMap.erase(Inst);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
for (auto kv : InstStmtMap)
|
|
||||||
assert(kv.getSecond() != &Stmt);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scop::removeStmts(std::function<bool(ScopStmt &)> ShouldDelete,
|
void Scop::removeStmts(std::function<bool(ScopStmt &)> ShouldDelete,
|
||||||
|
@ -2487,19 +2471,6 @@ ArrayRef<ScopStmt *> Scop::getStmtListFor(Region *R) const {
|
||||||
return getStmtListFor(R->getEntry());
|
return getStmtListFor(R->getEntry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scop::updateInstStmtMap(ArrayRef<Instruction *> OldList,
|
|
||||||
ArrayRef<Instruction *> NewList, ScopStmt *Stmt) {
|
|
||||||
for (Instruction *OldInst : OldList) {
|
|
||||||
assert(getStmtFor(OldInst) == Stmt);
|
|
||||||
InstStmtMap.erase(OldInst);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Instruction *NewInst : NewList) {
|
|
||||||
assert(InstStmtMap.lookup(NewInst) == nullptr);
|
|
||||||
InstStmtMap[NewInst] = Stmt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int Scop::getRelativeLoopDepth(const Loop *L) const {
|
int Scop::getRelativeLoopDepth(const Loop *L) const {
|
||||||
if (!L || !R.contains(L))
|
if (!L || !R.contains(L))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue