[polly] Isl ast gen compute out (PR #201859)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 03:40:09 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;
----------------
Meinersbur wrote:

It should check for `isl_map_dim(...) == isl_size_error` before doing any computation on them. Don't rely on a specific value of `isl_size_error`.

With isl-noexceptions.h, both error conditions have to be checked separately anyway. `isl::size` doesn't allow you to use the value before being checked for error. Feel free to use the C++ wrapper. 

https://github.com/llvm/llvm-project/pull/201859


More information about the llvm-commits mailing list