[PATCH] D45066: [Polly] [ScopInfo] Remove bail out condition in buildMinMaxAccess()
SAHIL GIRISH YERAWAR via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 14 11:58:59 PDT 2018
cs15btech11044 updated this revision to Diff 142522.
cs15btech11044 added a comment.
Changes made to this new patch:
1. Modified variable names according to LLVM coding standards.
2. Used `RunTimeChecksMaxAccessDisjuncts` for the initial check.
3. Modified the assertion according to @Meinersbur's second suggestion.
https://reviews.llvm.org/D45066
Files:
lib/Analysis/ScopInfo.cpp
Index: lib/Analysis/ScopInfo.cpp
===================================================================
--- lib/Analysis/ScopInfo.cpp
+++ lib/Analysis/ScopInfo.cpp
@@ -24,6 +24,7 @@
#include "polly/ScopDetection.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/ISLOStream.h"
+#include "polly/Support/ISLTools.h"
#include "polly/Support/SCEVAffinator.h"
#include "polly/Support/SCEVValidator.h"
#include "polly/Support/ScopHelper.h"
@@ -2299,15 +2300,19 @@
}
/// Add the minimal/maximal access in @p Set to @p User.
-static isl::stat
-buildMinMaxAccess(isl::set Set, Scop::MinMaxVectorTy &MinMaxAccesses, Scop &S) {
+static isl::stat buildMinMaxAccess(isl::set &Set,
+ Scop::MinMaxVectorTy &MinMaxAccesses,
+ Scop &S) {
isl::pw_multi_aff MinPMA, MaxPMA;
isl::pw_aff LastDimAff;
isl::aff OneAff;
unsigned Pos;
isl::ctx Ctx = Set.get_ctx();
- Set = Set.remove_divs();
+ polly::simplify(Set);
+
+ if (isl_set_n_basic_set(Set.get()) > RunTimeChecksMaxAccessDisjuncts)
+ Set = Set.simple_hull();
if (isl_set_n_basic_set(Set.get()) >= MaxDisjunctsInDomain)
return isl::stat::error;
@@ -2336,30 +2341,29 @@
return isl::stat::error;
}
- if (isl_set_n_basic_set(Set.get()) > RunTimeChecksMaxAccessDisjuncts)
- return isl::stat::error;
-
MinPMA = Set.lexmin_pw_multi_aff();
MaxPMA = Set.lexmax_pw_multi_aff();
- if (isl_ctx_last_error(Ctx.get()) == isl_error_quota)
- return isl::stat::error;
-
MinPMA = MinPMA.coalesce();
MaxPMA = MaxPMA.coalesce();
// Adjust the last dimension of the maximal access by one as we want to
// enclose the accessed memory region by MinPMA and MaxPMA. The pointer
// we test during code generation might now point after the end of the
// allocated array but we will never dereference it anyway.
- assert(MaxPMA.dim(isl::dim::out) && "Assumed at least one output dimension");
+ assert((!MaxPMA || MaxPMA.dim(isl::dim::out)) &&
+ "Assumed at least one output dimension");
+
Pos = MaxPMA.dim(isl::dim::out) - 1;
LastDimAff = MaxPMA.get_pw_aff(Pos);
OneAff = isl::aff(isl::local_space(LastDimAff.get_domain_space()));
OneAff = OneAff.add_constant_si(1);
LastDimAff = LastDimAff.add(OneAff);
MaxPMA = MaxPMA.set_pw_aff(Pos, LastDimAff);
+ if (!MinPMA || !MaxPMA)
+ return isl::stat::error;
+
MinMaxAccesses.push_back(std::make_pair(MinPMA, MaxPMA));
return isl::stat::ok;
@@ -2384,11 +2388,10 @@
Accesses = Accesses.intersect_domain(Domains);
isl::union_set Locations = Accesses.range();
- Locations = Locations.coalesce();
- Locations = Locations.detect_equalities();
auto Lambda = [&MinMaxAccesses, &S](isl::set Set) -> isl::stat {
- return buildMinMaxAccess(Set, MinMaxAccesses, S);
+ isl::set &SimpleSet = Set;
+ return buildMinMaxAccess(SimpleSet, MinMaxAccesses, S);
};
return Locations.foreach_set(Lambda) == isl::stat::ok;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45066.142522.patch
Type: text/x-patch
Size: 2992 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180414/27274b5e/attachment.bin>
More information about the llvm-commits
mailing list