[ISLTools/ZoneAlgo] Make distributeDomain and filterKnownValInst isl_error_quota proof.

distributeDomain() and filterKnownValInst() are used in a scop
of ForwardOpTree that limits the number of isl operations.
Therefore some isl functions may return null after any operation.

Remove assertion that assume non-null results and handle
isl_*_foreach returning isl::stat::error.

I hope this fixes the crash of the asop buildbot at ihevc_recon.c.

llvm-svn: 310461
This commit is contained in:
Michael Kruse 2017-08-09 11:21:40 +00:00
parent c6be2251b7
commit 630fc7b82a
2 changed files with 6 additions and 5 deletions

View File

@ -453,14 +453,11 @@ isl::map polly::distributeDomain(isl::map Map) {
auto Space = give(isl_map_get_space(Map.keep()));
auto DomainSpace = give(isl_space_domain(Space.copy()));
assert(DomainSpace);
auto DomainDims = isl_space_dim(DomainSpace.keep(), isl_dim_set);
auto RangeSpace = give(isl_space_unwrap(isl_space_range(Space.copy())));
auto Range1Space = give(isl_space_domain(RangeSpace.copy()));
assert(Range1Space);
auto Range1Dims = isl_space_dim(Range1Space.keep(), isl_dim_set);
auto Range2Space = give(isl_space_range(RangeSpace.copy()));
assert(Range2Space);
auto Range2Dims = isl_space_dim(Range2Space.keep(), isl_dim_set);
auto OutputSpace = give(isl_space_map_from_domain_and_range(
@ -497,11 +494,13 @@ isl::map polly::distributeDomain(isl::map Map) {
isl::union_map polly::distributeDomain(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 Success = UMap.foreach_map([=, &Result](isl::map Map) {
auto Distributed = distributeDomain(Map);
Result = give(isl_union_map_add_map(Result.take(), Distributed.copy()));
return isl::stat::ok;
});
if (Success != isl::stat::ok)
return {};
return Result;
}

View File

@ -248,11 +248,13 @@ static bool isMapToUnknown(const isl::map &Map) {
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 {
isl::stat Success = UMap.foreach_map([=, &Result](isl::map Map) -> isl::stat {
if (!isMapToUnknown(Map))
Result = Result.add_map(Map);
return isl::stat::ok;
});
if (Success != isl::stat::ok)
return {};
return Result;
}