[polly] Isl ast gen compute out (PR #201859)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 13 03:54:35 PDT 2026
================
@@ -717,34 +717,44 @@ bool Dependences::isParallel(__isl_keep isl_union_map *Schedule,
__isl_give isl_pw_aff **MinDistancePtr) const {
isl_set *Deltas, *Distance;
isl_map *ScheduleDeps;
- unsigned Dimension;
+ int Dimension;
bool IsParallel;
Deps = isl_union_map_apply_range(Deps, isl_union_map_copy(Schedule));
Deps = isl_union_map_apply_domain(Deps, isl_union_map_copy(Schedule));
+ isl_bool UnionMapIsEmpty = isl_union_map_is_empty(Deps);
- if (isl_union_map_is_empty(Deps)) {
+ if (UnionMapIsEmpty != isl_bool_false) {
isl_union_map_free(Deps);
- return true;
+ return UnionMapIsEmpty == isl_bool_true;
}
ScheduleDeps = isl_map_from_union_map(Deps);
+ // In the event isl_map_dim() returns isl_size_error which is -1
+ // then Dimension being an unsigned variable would store a very large
+ // wrap-around value. This could result in compilation issues like indefinite
+ // hang. Thus changed Dimension into an signed integer storage
Dimension = isl_map_dim(ScheduleDeps, isl_dim_out) - 1;
- for (unsigned i = 0; i < Dimension; i++)
+ if (Dimension < 0) {
+ isl_map_free(ScheduleDeps);
+ return false;
----------------
Meinersbur wrote:
Maybe renaming the function to `isKnownParallel` would make that clear -- only returns true if it can positively confirm it is parallel.
https://github.com/llvm/llvm-project/pull/201859
More information about the llvm-commits
mailing list