[PATCH] [Polly][REFACTOR] Simplify the SCoP detection interface a bit

Johannes Doerfert doerfert at cs.uni-saarland.de
Thu Feb 19 06:40:15 PST 2015


Hi grosser,

http://reviews.llvm.org/D7757

Files:
  include/polly/ScopDetection.h
  lib/Analysis/ScopDetection.cpp

Index: include/polly/ScopDetection.h
===================================================================
--- include/polly/ScopDetection.h
+++ include/polly/ScopDetection.h
@@ -205,13 +205,6 @@
   /// @return True if R is a Scop, false otherwise.
   bool isValidRegion(DetectionContext &Context) const;
 
-  /// @brief Check if a region is a Scop.
-  ///
-  /// @param Context The context of scop detection.
-  ///
-  /// @return True if R is a Scop, false otherwise.
-  bool isValidRegion(Region &R) const;
-
   /// @brief Check if a call instruction can be part of a Scop.
   ///
   /// @param CI The call instruction to check.
Index: lib/Analysis/ScopDetection.cpp
===================================================================
--- lib/Analysis/ScopDetection.cpp
+++ lib/Analysis/ScopDetection.cpp
@@ -251,8 +251,10 @@
   if (!ValidRegions.count(&R))
     return false;
 
-  if (Verify)
-    return isValidRegion(const_cast<Region &>(R));
+  if (Verify) {
+    DetectionContext Context(const_cast<Region &>(R), *AA, false /*verifying*/);
+    return isValidRegion(Context);
+  }
 
   return true;
 }
@@ -731,10 +733,14 @@
   if (!DetectRegionsWithoutLoops && regionWithoutLoops(R, LI))
     return;
 
-  bool IsValidRegion = isValidRegion(R);
-  bool HasErrors = RejectLogs.count(&R) > 0;
+  DetectionContext Context(R, *AA, false /*verifying*/);
+  bool RegionIsValid = isValidRegion(Context);
+  bool HasErrors = !RegionIsValid || Context.Log.size() > 0;
 
-  if (IsValidRegion && !HasErrors) {
+  if (PollyTrackFailures && HasErrors)
+    RejectLogs.insert(std::make_pair(&R, Context.Log));
+
+  if (!HasErrors) {
     ++ValidRegion;
     ValidRegions.insert(&R);
     return;
@@ -817,18 +823,6 @@
   return true;
 }
 
-bool ScopDetection::isValidRegion(Region &R) const {
-  DetectionContext Context(R, *AA, false /*verifying*/);
-
-  bool RegionIsValid = isValidRegion(Context);
-  bool HasErrors = !RegionIsValid || Context.Log.size() > 0;
-
-  if (PollyTrackFailures && HasErrors)
-    RejectLogs.insert(std::make_pair(&R, Context.Log));
-
-  return RegionIsValid;
-}
-
 bool ScopDetection::isValidRegion(DetectionContext &Context) const {
   Region &R = Context.CurRegion;

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7757.20291.patch
Type: text/x-patch
Size: 2191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150219/1e240b5f/attachment.bin>


More information about the llvm-commits mailing list