[polly] 6538fff - [Polly] Inline ShoulDelete lambda. NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 11:16:09 PDT 2020


Author: Michael Kruse
Date: 2020-08-26T13:15:23-05:00
New Revision: 6538fff37245921a0983d94c08af7e6cc120b3a9

URL: https://github.com/llvm/llvm-project/commit/6538fff37245921a0983d94c08af7e6cc120b3a9
DIFF: https://github.com/llvm/llvm-project/commit/6538fff37245921a0983d94c08af7e6cc120b3a9.diff

LOG: [Polly] Inline ShoulDelete lambda. NFC.

As suggested by David Blaikie at
ihttps://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20200824/822584.html

Added: 
    

Modified: 
    polly/lib/Analysis/ScopInfo.cpp
    polly/lib/Transform/Simplify.cpp

Removed: 
    


################################################################################
diff  --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index a50e1a7f91af..ba462351af57 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -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;
-
-    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 f3b8bf83efe5..d699aa4f4990 100644
--- a/polly/lib/Transform/Simplify.cpp
+++ b/polly/lib/Transform/Simplify.cpp
@@ -169,12 +169,11 @@ class Simplify : public ScopPass {
   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();


        


More information about the llvm-commits mailing list