From 6538fff37245921a0983d94c08af7e6cc120b3a9 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Wed, 26 Aug 2020 13:11:41 -0500 Subject: [Polly] Inline ShoulDelete lambda. NFC. As suggested by David Blaikie at ihttps://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20200824/822584.html --- polly/lib/Analysis/ScopInfo.cpp | 53 ++++++++++++++++++++-------------------- polly/lib/Transform/Simplify.cpp | 5 ++-- 2 files changed, 28 insertions(+), 30 deletions(-) (limited to 'polly') diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index a50e1a7..ba46235 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -1773,40 +1773,39 @@ void Scop::removeStmts(function_ref 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; - - 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; - - OnlyRead = false; - break; - } - - RemoveStmt = OnlyRead; - } - return RemoveStmt; - }; - - removeStmts(ShouldDelete, AfterHoisting); + removeStmts( + [AfterHoisting](ScopStmt &Stmt) -> bool { + // Never delete statements that contain calls to debug functions. + if (hasDebugCall(&Stmt)) + return false; + + 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; + + OnlyRead = false; + break; + } + + RemoveStmt = OnlyRead; + } + return RemoveStmt; + }, + AfterHoisting); } InvariantEquivClassTy *Scop::lookupInvariantEquivClass(Value *Val) { diff --git a/polly/lib/Transform/Simplify.cpp b/polly/lib/Transform/Simplify.cpp index f3b8bf8..d699aa4 100644 --- a/polly/lib/Transform/Simplify.cpp +++ b/polly/lib/Transform/Simplify.cpp @@ -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(); -- cgit v1.1