diff options
| author | Michael Kruse <llvm@meinersbur.de> | 2017-08-08 17:00:27 +0000 |
|---|---|---|
| committer | Michael Kruse <llvm@meinersbur.de> | 2017-08-08 17:00:27 +0000 |
| commit | ce67358281ce7c76e6f34ec4d18a53228810df9c (patch) | |
| tree | 52b81dd3e4456b1050f11d80386237ac2fe0c49f | |
| parent | 1563f039f5049c0641732a2f00ee499e6c43f678 (diff) | |
| download | bcm5719-llvm-ce67358281ce7c76e6f34ec4d18a53228810df9c.tar.gz bcm5719-llvm-ce67358281ce7c76e6f34ec4d18a53228810df9c.zip | |
[DeLICM/ZoneAlgo] Remove duplicate code. NFC.
DeLICM and ZoneAlgo both implemented filterKnownValInst.
Declare ZoneAlgo's version in the header and let DeLCIM use it.
llvm-svn: 310381
| -rw-r--r-- | polly/include/polly/ZoneAlgo.h | 7 | ||||
| -rw-r--r-- | polly/lib/Transform/DeLICM.cpp | 25 | ||||
| -rw-r--r-- | polly/lib/Transform/ZoneAlgo.cpp | 7 |
3 files changed, 8 insertions, 31 deletions
diff --git a/polly/include/polly/ZoneAlgo.h b/polly/include/polly/ZoneAlgo.h index a88b918ed37..2128dc796e1 100644 --- a/polly/include/polly/ZoneAlgo.h +++ b/polly/include/polly/ZoneAlgo.h @@ -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: diff --git a/polly/lib/Transform/DeLICM.cpp b/polly/lib/Transform/DeLICM.cpp index 8a47d21c504..bad986a7f97 100644 --- a/polly/lib/Transform/DeLICM.cpp +++ b/polly/lib/Transform/DeLICM.cpp @@ -121,31 +121,6 @@ isl::map computeScalarReachingOverwrite(isl::union_map Schedule, 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. /// diff --git a/polly/lib/Transform/ZoneAlgo.cpp b/polly/lib/Transform/ZoneAlgo.cpp index d8618a56f8f..70105f5ac22 100644 --- a/polly/lib/Transform/ZoneAlgo.cpp +++ b/polly/lib/Transform/ZoneAlgo.cpp @@ -246,12 +246,7 @@ static bool isMapToUnknown(const isl::map &Map) { 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)) |

