From 783ae411c28ae67dfa2c0e04bd74c8985f8e1f2b Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 22 Dec 2017 01:10:31 +0000 Subject: [PATCH] Fix isl out-of-quota errors affecting later quota guards. If an out-of-quota error occurred, the last error would be isl_error_quota unless a different error occured. We typically check whether the max-operations occured by comparing to that error value after leaving the quota guard. This would check whether there ever was a quota-error, not just in the last quota guards. The observable bug occurred if the max-operations limit was reached in DeLICM, and if -polly-dependences-computout=0, DependenceInfo would think that the quota for computing dependencies was the reason, i.e., fail the operation even if the calculation itself was successful. Fix by reseting the last error to isl_error_none when entering a quota guard, signaling that no quota error occured unless in the guard's scope. git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@321329 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/polly/Support/GICHelper.h | 6 ++++++ test/DeLICM/reject_outofquota.ll | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/polly/Support/GICHelper.h b/include/polly/Support/GICHelper.h index a30d1d01..3c0fe40b 100644 --- a/include/polly/Support/GICHelper.h +++ b/include/polly/Support/GICHelper.h @@ -396,6 +396,12 @@ public: assert(isl_ctx_get_max_operations(IslCtx) == 0 && "Nested max operations not supported"); + // Users of this guard may check whether the last error was isl_error_quota. + // Reset the last error such that a previous out-of-quota error is not + // mistaken to have occurred in the in this quota, even if the max number of + // operations is set to infinite (LocalMaxOps == 0). + isl_ctx_reset_error(IslCtx); + if (LocalMaxOps == 0) { // No limit on operations; also disable restoring on_error/max_operations. this->IslCtx = nullptr; diff --git a/test/DeLICM/reject_outofquota.ll b/test/DeLICM/reject_outofquota.ll index eac19435..95ac67ac 100644 --- a/test/DeLICM/reject_outofquota.ll +++ b/test/DeLICM/reject_outofquota.ll @@ -1,4 +1,5 @@ ; RUN: opt %loadPolly -polly-delicm -analyze -pass-remarks-analysis=polly-delicm -polly-delicm-max-ops=1 < %s 2>&1 | FileCheck %s +; RUN: opt %loadPolly -polly-delicm -polly-dependences -analyze -polly-delicm-max-ops=1 -polly-dependences-computeout=0 < %s | FileCheck %s -check-prefix=DEP ; ; void func(double *A) { ; for (int j = 0; j < 2; j += 1) { /* outer */ @@ -63,3 +64,16 @@ return: ; CHECK: maximal number of operations exceeded during zone analysis + +; Check that even if the quota was exceeded in DeLICM, DependenceInfo is still +; successfull since it uses a different operations counter. +; +; DEP: RAW dependences: +; DEP-NOT: n/a +; DEP: WAR dependences: +; DEP-NOT: n/a +; DEP: WAW dependences: +; DEP-NOT: n/a +; DEP: Reduction dependences: +; DEP-NOT: n/a +; DEP: Transitive closure of reduction dependences: -- 2.11.4.GIT