diff options
author | Tobias Grosser <tobias@grosser.es> | 2018-04-28 20:42:35 +0000 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2018-04-28 20:42:35 +0000 |
commit | 77e871aaf509a50ad5208ece52054f3b793b9be9 (patch) | |
tree | e533e196579c2d9aea78e9f7e262be2acc8809a8 | |
parent | 06624e1a93adf5c8f105d43bfb4a828dc6a8bad5 (diff) | |
download | bcm5719-llvm-77e871aaf509a50ad5208ece52054f3b793b9be9.tar.gz bcm5719-llvm-77e871aaf509a50ad5208ece52054f3b793b9be9.zip |
[MaximalStaticExpansion] Replace copied function with version from ISLTools
llvm-svn: 331118
-rw-r--r-- | polly/lib/Transform/MaximalStaticExpansion.cpp | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/polly/lib/Transform/MaximalStaticExpansion.cpp b/polly/lib/Transform/MaximalStaticExpansion.cpp index f8856f571a6..b15a2820a8c 100644 --- a/polly/lib/Transform/MaximalStaticExpansion.cpp +++ b/polly/lib/Transform/MaximalStaticExpansion.cpp @@ -17,6 +17,7 @@ #include "polly/ScopInfo.h" #include "polly/ScopPass.h" #include "polly/Support/GICHelper.h" +#include "polly/Support/ISLTools.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringRef.h" #include "llvm/Analysis/OptimizationRemarkEmitter.h" @@ -128,49 +129,6 @@ static bool isDimBoundedByConstant(isl::set Set, unsigned dim) { } #endif -/// If @p PwAff maps to a constant, return said constant. If @p Max/@p Min, it -/// can also be a piecewise constant and it would return the minimum/maximum -/// value. Otherwise, return NaN. -static isl::val getConstant(isl::pw_aff PwAff, bool Max, bool Min) { - assert(!Max || !Min); - isl::val Result; - PwAff.foreach_piece([=, &Result](isl::set Set, isl::aff Aff) -> isl::stat { - if (Result && Result.is_nan()) - return isl::stat::ok; - - // TODO: If Min/Max, we can also determine a minimum/maximum value if - // Set is constant-bounded. - if (!Aff.is_cst()) { - Result = isl::val::nan(Aff.get_ctx()); - return isl::stat::error; - } - - auto ThisVal = Aff.get_constant_val(); - if (!Result) { - Result = ThisVal; - return isl::stat::ok; - } - - if (Result.eq(ThisVal)) - return isl::stat::ok; - - if (Max && ThisVal.gt(Result)) { - Result = ThisVal; - return isl::stat::ok; - } - - if (Min && ThisVal.lt(Result)) { - Result = ThisVal; - return isl::stat::ok; - } - - // Not compatible - Result = isl::val::nan(Aff.get_ctx()); - return isl::stat::error; - }); - return Result; -} - char MaximalStaticExpander::ID = 0; isl::union_map MaximalStaticExpander::filterDependences( |