From 630fc7b82a1150c87bee48b7ea9a0ec76f89f723 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Wed, 9 Aug 2017 11:21:40 +0000 Subject: [PATCH] [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 --- polly/lib/Support/ISLTools.cpp | 7 +++---- polly/lib/Transform/ZoneAlgo.cpp | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/polly/lib/Support/ISLTools.cpp b/polly/lib/Support/ISLTools.cpp index 06d4973..cb2ca9d 100644 --- a/polly/lib/Support/ISLTools.cpp +++ b/polly/lib/Support/ISLTools.cpp @@ -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; } diff --git a/polly/lib/Transform/ZoneAlgo.cpp b/polly/lib/Transform/ZoneAlgo.cpp index 8ae5d9b..1cbac59 100644 --- a/polly/lib/Transform/ZoneAlgo.cpp +++ b/polly/lib/Transform/ZoneAlgo.cpp @@ -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; } -- 2.7.4