[polly] r313546 - [ForwardOpTree] Test the max operations quota.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 10:43:50 PDT 2017


Author: meinersbur
Date: Mon Sep 18 10:43:50 2017
New Revision: 313546

URL: http://llvm.org/viewvc/llvm-project?rev=313546&view=rev
Log:
[ForwardOpTree] Test the max operations quota.

cl::opt<unsigned long> is not specialized and hence the option
-polly-optree-max-ops impossible to use.

Replace by supported option cl::opt<unsigned>.

Also check for an error state when computing the written value, which
happens when the quota runs out.

Added:
    polly/trunk/test/ForwardOpTree/noforward_outofquota.ll
Modified:
    polly/trunk/lib/Transform/ForwardOpTree.cpp
    polly/trunk/lib/Transform/ZoneAlgo.cpp

Modified: polly/trunk/lib/Transform/ForwardOpTree.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ForwardOpTree.cpp?rev=313546&r1=313545&r2=313546&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ForwardOpTree.cpp (original)
+++ polly/trunk/lib/Transform/ForwardOpTree.cpp Mon Sep 18 10:43:50 2017
@@ -51,7 +51,7 @@ static cl::opt<bool>
                  cl::desc("Analyze array contents for load forwarding"),
                  cl::cat(PollyCategory), cl::init(true), cl::Hidden);
 
-static cl::opt<unsigned long>
+static cl::opt<unsigned>
     MaxOps("polly-optree-max-ops",
            cl::desc("Maximum number of ISL operations to invest for known "
                     "analysis; 0=no limit"),

Modified: polly/trunk/lib/Transform/ZoneAlgo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ZoneAlgo.cpp?rev=313546&r1=313545&r2=313546&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ZoneAlgo.cpp (original)
+++ polly/trunk/lib/Transform/ZoneAlgo.cpp Mon Sep 18 10:43:50 2017
@@ -422,7 +422,7 @@ isl::map ZoneAlgorithm::getWrittenValue(
                                      : Stmt->getSurroundingLoop();
   if (AccVal &&
       AccVal->getType() == MA->getLatestScopArrayInfo()->getElementType() &&
-      AccRel.is_single_valued())
+      AccRel.is_single_valued().is_true())
     return makeValInst(AccVal, Stmt, L);
 
   // memset(_, '0', ) is equivalent to writing the null value to all touched

Added: polly/trunk/test/ForwardOpTree/noforward_outofquota.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ForwardOpTree/noforward_outofquota.ll?rev=313546&view=auto
==============================================================================
--- polly/trunk/test/ForwardOpTree/noforward_outofquota.ll (added)
+++ polly/trunk/test/ForwardOpTree/noforward_outofquota.ll Mon Sep 18 10:43:50 2017
@@ -0,0 +1,48 @@
+; RUN: opt %loadPolly -polly-optree-max-ops=1 -polly-optree -analyze < %s | FileCheck %s -match-full-lines
+; RUN: opt %loadPolly -polly-optree-max-ops=1 -polly-optree -disable-output -stats < %s 2>&1 | FileCheck %s -match-full-lines -check-prefix=STATS
+; REQUIRES: asserts
+;
+; for (int j = 0; j < n; j += 1) {
+; bodyA:
+;   double val = B[j];
+;
+; bodyB:
+;   A[j] = val;
+; }
+;
+define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
+entry:
+  br label %for
+
+for:
+  %j = phi i32 [0, %entry], [%j.inc, %inc]
+  %j.cmp = icmp slt i32 %j, %n
+  br i1 %j.cmp, label %bodyA, label %exit
+
+    bodyA:
+      %B_idx = getelementptr inbounds double, double* %B, i32 %j
+      %val = load double, double* %B_idx
+      br label %bodyB
+
+    bodyB:
+      %A_idx = getelementptr inbounds double, double* %A, i32 %j
+      store double %val, double* %A_idx
+      br label %inc
+
+inc:
+  %j.inc = add nuw nsw i32 %j, 1
+  br label %for
+
+exit:
+  br label %return
+
+return:
+  ret void
+}
+
+
+; CHECK: ForwardOpTree executed, but did not modify anything
+
+; STATS-NOT: IMPLEMENTATION ERROR: Unhandled error state
+; STATS: 1 polly-optree     - Analyses aborted because max_operations was reached
+; STATS-NOT: IMPLEMENTATION ERROR: Unhandled error state




More information about the llvm-commits mailing list