[Simplify] Move to isl C++

llvm-svn: 303507
This commit is contained in:
Tobias Grosser 2017-05-21 16:12:21 +00:00
parent 6151654c00
commit b5f61bdeeb
1 changed files with 13 additions and 19 deletions

View File

@ -131,7 +131,7 @@ private:
/// one element in @p Targets.
MemoryAccess *hasWriteBetween(ScopStmt *Stmt, MemoryAccess *From,
MemoryAccess *To, isl::map Targets) {
auto TargetsSpace = give(isl_map_get_space(Targets.keep()));
auto TargetsSpace = Targets.get_space();
bool Started = Stmt->isRegionStmt();
for (auto *Acc : *Stmt) {
@ -154,18 +154,16 @@ private:
continue;
auto AccRel = give(Acc->getAccessRelation());
auto AccRelSpace = give(isl_map_get_space(AccRel.keep()));
auto AccRelSpace = AccRel.get_space();
// Spaces being different means that they access different arrays.
if (isl_space_has_equal_tuples(TargetsSpace.keep(), AccRelSpace.keep()) ==
isl_bool_false)
if (!TargetsSpace.has_equal_tuples(AccRelSpace))
continue;
AccRel = give(isl_map_intersect_domain(AccRel.take(),
Acc->getStatement()->getDomain()));
AccRel = give(isl_map_intersect_params(AccRel.take(), S->getContext()));
auto CommonElt = give(isl_map_intersect(Targets.copy(), AccRel.copy()));
if (isl_map_is_empty(CommonElt.keep()) != isl_bool_true)
AccRel = AccRel.intersect_domain(give(Acc->getStatement()->getDomain()));
AccRel = AccRel.intersect_params(give(S->getContext()));
auto CommonElt = Targets.intersect(AccRel);
if (!CommonElt.is_empty())
return Acc;
}
assert(Stmt->isRegionStmt() &&
@ -208,9 +206,7 @@ private:
// If all of a write's elements are overwritten, remove it.
isl::union_map AccRelUnion = AccRel;
if (isl_union_map_is_subset(AccRelUnion.keep(),
WillBeOverwritten.keep()) ==
isl_bool_true) {
if (AccRelUnion.is_subset(WillBeOverwritten)) {
DEBUG(dbgs() << "Removing " << MA
<< " which will be overwritten anyway\n");
@ -252,15 +248,13 @@ private:
continue;
auto WARel = give(WA->getLatestAccessRelation());
WARel = give(isl_map_intersect_domain(WARel.take(),
WA->getStatement()->getDomain()));
WARel = give(isl_map_intersect_params(WARel.take(), S->getContext()));
WARel = WARel.intersect_domain(give(WA->getStatement()->getDomain()));
WARel = WARel.intersect_params(give(S->getContext()));
auto RARel = give(RA->getLatestAccessRelation());
RARel = give(isl_map_intersect_domain(RARel.take(),
RA->getStatement()->getDomain()));
RARel = give(isl_map_intersect_params(RARel.take(), S->getContext()));
RARel = RARel.intersect_domain(give(RA->getStatement()->getDomain()));
RARel = RARel.intersect_params(give(S->getContext()));
if (isl_map_is_equal(RARel.keep(), WARel.keep()) != isl_bool_true) {
if (!RARel.is_equal(WARel)) {
PairUnequalAccRels++;
DEBUG(dbgs() << "Not cleaning up " << WA
<< " because of unequal access relations:\n");