[polly] Isl ast gen compute out (PR #201859)
Shikhar Jain via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 12 23:03:46 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;
----------------
ShikharJ-Corp wrote:
hi.. Agreed. isParallel returns a plain bool, so "ISL op failed / unknown" and "computed, not parallel" both collapse to false. false is the safe choice .the caller just won't mark the loop parallel (missed parallelization at worst, never a miscompile; true would be unsafe). Cleaner would be widening the return type , but that touches all callers — can do as a follow-up.
https://github.com/llvm/llvm-project/pull/201859
More information about the llvm-commits
mailing list