From e05785999bf8f1e0cf8babc16f7d7ba9a7bf6d1d Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Wed, 5 Nov 2025 14:02:24 +0100 Subject: [PATCH] [Polly] Check for ISL errors --- polly/lib/Transform/ScheduleOptimizer.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp index 0888ebd7a9362..cb08397c201f2 100644 --- a/polly/lib/Transform/ScheduleOptimizer.cpp +++ b/polly/lib/Transform/ScheduleOptimizer.cpp @@ -927,9 +927,24 @@ static void runIslScheduleOptimizer( walkScheduleTreeForStatistics(Schedule, 2); } + // Check for why any computation could have failed if (MaxOpGuard.hasQuotaExceeded()) { POLLY_DEBUG(dbgs() << "Schedule optimizer calculation exceeds ISL quota\n"); return; + } else if (isl_ctx_last_error(Ctx) != isl_error_none) { + const char *File = isl_ctx_last_error_file(Ctx); + int Line = isl_ctx_last_error_line(Ctx); + const char *Msg = isl_ctx_last_error_msg(Ctx); + POLLY_DEBUG( + dbgs() + << "ISL reported an error during the computation of a new schedule at " + << File << ":" << Line << ": " << Msg); + isl_ctx_reset_error(Ctx); + return; + } else if (Schedule.is_null()) { + POLLY_DEBUG(dbgs() << "Schedule optimizer did not compute a new schedule " + "for unknown reasons\n"); + return; } // Skip profitability check if user transformation(s) have been applied.