[polly] r310381 - [DeLICM/ZoneAlgo] Remove duplicate code. NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 10:00:27 PDT 2017


Author: meinersbur
Date: Tue Aug  8 10:00:27 2017
New Revision: 310381

URL: http://llvm.org/viewvc/llvm-project?rev=310381&view=rev
Log:
[DeLICM/ZoneAlgo] Remove duplicate code. NFC.

DeLICM and ZoneAlgo both implemented filterKnownValInst.

Declare ZoneAlgo's version in the header and let DeLCIM use it.

Modified:
    polly/trunk/include/polly/ZoneAlgo.h
    polly/trunk/lib/Transform/DeLICM.cpp
    polly/trunk/lib/Transform/ZoneAlgo.cpp

Modified: polly/trunk/include/polly/ZoneAlgo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ZoneAlgo.h?rev=310381&r1=310380&r2=310381&view=diff
==============================================================================
--- polly/trunk/include/polly/ZoneAlgo.h (original)
+++ polly/trunk/include/polly/ZoneAlgo.h Tue Aug  8 10:00:27 2017
@@ -29,6 +29,13 @@ class Scop;
 class ScopStmt;
 class MemoryAccess;
 
+/// Return only the mappings that map to known values.
+///
+/// @param UMap { [] -> ValInst[] }
+///
+/// @return { [] -> ValInst[] }
+isl::union_map filterKnownValInst(const isl::union_map &UMap);
+
 /// Base class for algorithms based on zones, like DeLICM.
 class ZoneAlgorithm {
 protected:

Modified: polly/trunk/lib/Transform/DeLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/DeLICM.cpp?rev=310381&r1=310380&r2=310381&view=diff
==============================================================================
--- polly/trunk/lib/Transform/DeLICM.cpp (original)
+++ polly/trunk/lib/Transform/DeLICM.cpp Tue Aug  8 10:00:27 2017
@@ -121,31 +121,6 @@ isl::map computeScalarReachingOverwrite(
   return singleton(std::move(ReachOverwrite), ResultSpace);
 }
 
-/// Return whether @p Map maps to an unknown value.
-///
-/// @param { [] -> ValInst[] }
-bool isMapToUnknown(const isl::map &Map) {
-  auto Space = give(isl_space_range(isl_map_get_space(Map.keep())));
-  return !isl_map_has_tuple_id(Map.keep(), isl_dim_set) &&
-         !isl_space_is_wrapping(Space.keep()) &&
-         isl_map_dim(Map.keep(), isl_dim_out) == 0;
-}
-
-/// Return only the mappings that map to known values.
-///
-/// @param UMap { [] -> ValInst[] }
-///
-/// @return { [] -> ValInst[] }
-isl::union_map filterKnownValInst(const isl::union_map &UMap) {
-  auto Result = give(isl_union_map_empty(isl_union_map_get_space(UMap.keep())));
-  UMap.foreach_map([=, &Result](isl::map Map) -> isl::stat {
-    if (!isMapToUnknown(Map))
-      Result = give(isl_union_map_add_map(Result.take(), Map.take()));
-    return isl::stat::ok;
-  });
-  return Result;
-}
-
 /// Try to find a 'natural' extension of a mapped to elements outside its
 /// domain.
 ///

Modified: polly/trunk/lib/Transform/ZoneAlgo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ZoneAlgo.cpp?rev=310381&r1=310380&r2=310381&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ZoneAlgo.cpp (original)
+++ polly/trunk/lib/Transform/ZoneAlgo.cpp Tue Aug  8 10:00:27 2017
@@ -246,12 +246,7 @@ static bool isMapToUnknown(const isl::ma
          Space.is_wrapping().is_false() && Space.dim(isl::dim::set) == 0;
 }
 
-/// Return only the mappings that map to known values.
-///
-/// @param UMap { [] -> ValInst[] }
-///
-/// @return { [] -> ValInst[] }
-static isl::union_map filterKnownValInst(const isl::union_map &UMap) {
+isl::union_map polly::filterKnownValInst(const isl::union_map &UMap) {
   isl::union_map Result = isl::union_map::empty(UMap.get_space());
   UMap.foreach_map([=, &Result](isl::map Map) -> isl::stat {
     if (!isMapToUnknown(Map))




More information about the llvm-commits mailing list