forked from OSchip/llvm-project
[Polly] Inline ShoulDelete lambda. NFC.
As suggested by David Blaikie at ihttps://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20200824/822584.html
This commit is contained in:
parent
c971b53b22
commit
6538fff372
|
@ -1773,40 +1773,39 @@ void Scop::removeStmts(function_ref<bool(ScopStmt &)> ShouldDelete,
|
|||
}
|
||||
|
||||
void Scop::removeStmtNotInDomainMap() {
|
||||
auto ShouldDelete = [this](ScopStmt &Stmt) -> bool {
|
||||
removeStmts([this](ScopStmt &Stmt) -> bool {
|
||||
isl::set Domain = DomainMap.lookup(Stmt.getEntryBlock());
|
||||
if (!Domain)
|
||||
return true;
|
||||
return Domain.is_empty();
|
||||
};
|
||||
removeStmts(ShouldDelete, false);
|
||||
});
|
||||
}
|
||||
|
||||
void Scop::simplifySCoP(bool AfterHoisting) {
|
||||
auto ShouldDelete = [AfterHoisting](ScopStmt &Stmt) -> bool {
|
||||
// Never delete statements that contain calls to debug functions.
|
||||
if (hasDebugCall(&Stmt))
|
||||
return false;
|
||||
removeStmts(
|
||||
[AfterHoisting](ScopStmt &Stmt) -> bool {
|
||||
// Never delete statements that contain calls to debug functions.
|
||||
if (hasDebugCall(&Stmt))
|
||||
return false;
|
||||
|
||||
bool RemoveStmt = Stmt.isEmpty();
|
||||
bool RemoveStmt = Stmt.isEmpty();
|
||||
|
||||
// Remove read only statements only after invariant load hoisting.
|
||||
if (!RemoveStmt && AfterHoisting) {
|
||||
bool OnlyRead = true;
|
||||
for (MemoryAccess *MA : Stmt) {
|
||||
if (MA->isRead())
|
||||
continue;
|
||||
// Remove read only statements only after invariant load hoisting.
|
||||
if (!RemoveStmt && AfterHoisting) {
|
||||
bool OnlyRead = true;
|
||||
for (MemoryAccess *MA : Stmt) {
|
||||
if (MA->isRead())
|
||||
continue;
|
||||
|
||||
OnlyRead = false;
|
||||
break;
|
||||
}
|
||||
OnlyRead = false;
|
||||
break;
|
||||
}
|
||||
|
||||
RemoveStmt = OnlyRead;
|
||||
}
|
||||
return RemoveStmt;
|
||||
};
|
||||
|
||||
removeStmts(ShouldDelete, AfterHoisting);
|
||||
RemoveStmt = OnlyRead;
|
||||
}
|
||||
return RemoveStmt;
|
||||
},
|
||||
AfterHoisting);
|
||||
}
|
||||
|
||||
InvariantEquivClassTy *Scop::lookupInvariantEquivClass(Value *Val) {
|
||||
|
|
|
@ -169,12 +169,11 @@ private:
|
|||
void removeEmptyDomainStmts() {
|
||||
size_t NumStmtsBefore = S->getSize();
|
||||
|
||||
auto ShouldDelete = [](ScopStmt &Stmt) -> bool {
|
||||
S->removeStmts([](ScopStmt &Stmt) -> bool {
|
||||
auto EffectiveDomain =
|
||||
Stmt.getDomain().intersect_params(Stmt.getParent()->getContext());
|
||||
return EffectiveDomain.is_empty();
|
||||
};
|
||||
S->removeStmts(ShouldDelete);
|
||||
});
|
||||
|
||||
assert(NumStmtsBefore >= S->getSize());
|
||||
EmptyDomainsRemoved = NumStmtsBefore - S->getSize();
|
||||
|
|
Loading…
Reference in New Issue