[llvm] [clang] [polly] [polly][ScheduleOptimizer] Fix long compile time(hang) reported in polly (PR #75141)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 12 16:45:27 PST 2023


================
@@ -860,7 +867,25 @@ static void runIslScheduleOptimizer(
     SC = SC.set_proximity(Proximity);
     SC = SC.set_validity(Validity);
     SC = SC.set_coincidence(Validity);
+
+    // Save error handling behavior
+    long MaxOperations = isl_ctx_get_max_operations(Ctx);
+    isl_ctx_set_max_operations(Ctx, ScheduleComputeOut);
     Schedule = SC.compute_schedule();
+    bool ScheduleQuota = false;
+    if (isl_ctx_last_error(Ctx) == isl_error_quota) {
+      isl_ctx_reset_error(Ctx);
+      LLVM_DEBUG(
+          dbgs() << "Schedule optimizer calculation exceeds ISL quota\n");
+      ScheduleQuota = true;
+    }
+    isl_options_set_on_error(Ctx, ISL_ON_ERROR_ABORT);
----------------
efriedma-quic wrote:

This isl_options_set_on_error call doesn't seem right; we should move the existing call to `isl_options_set_on_error(Ctx, OnErrorStatus);` before the early return.

(Not sure my suggested change actually has any visible effect given the actual usage of isl here, but still, it's confusing to save the on_error and not restore it properly.)

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


More information about the cfe-commits mailing list