[polly] r302234 - [ScopBuilder] Do not verify unfeasible SCoPs.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 06:38:35 PDT 2017


Author: meinersbur
Date: Fri May  5 08:38:35 2017
New Revision: 302234

URL: http://llvm.org/viewvc/llvm-project?rev=302234&view=rev
Log:
[ScopBuilder] Do not verify unfeasible SCoPs.

SCoPs with unfeasible runtime context are thrown away and therefore
do not need their uses verified.

The added test case requires a complexity limit to exceed.
Normally, error statements are removed from the SCoP and for that
reason are skipped during the verification. If there is a unfeasible
runtime context (here: because of the complexity limit being reached),
the removal of error statements and other SCoP construction steps are
skipped to not waste time. Error statements are not modeled in SCoPs
and therefore have no requirements on whether the scalars used in
them are available.

Added:
    polly/trunk/test/ScopInfo/inter-error-bb-dependence.ll
Modified:
    polly/trunk/lib/Analysis/ScopBuilder.cpp

Modified: polly/trunk/lib/Analysis/ScopBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopBuilder.cpp?rev=302234&r1=302233&r2=302234&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopBuilder.cpp (original)
+++ polly/trunk/lib/Analysis/ScopBuilder.cpp Fri May  5 08:38:35 2017
@@ -655,6 +655,12 @@ static void verifyUse(Scop *S, Use &Op,
 /// to pick up the virtual uses. But here in the code generator, this has not
 /// happened yet, such that virtual and physical uses are equivalent.
 static void verifyUses(Scop *S, LoopInfo &LI, DominatorTree &DT) {
+  // We require the SCoP to be fully built. Without feasible context, some
+  // construction steps are skipped. In particular, we require error statements
+  // to be removed.
+  if (!S->hasFeasibleRuntimeContext())
+    return;
+
   for (auto *BB : S->getRegion().blocks()) {
     auto *Stmt = S->getStmtFor(BB);
     if (!Stmt)

Added: polly/trunk/test/ScopInfo/inter-error-bb-dependence.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/inter-error-bb-dependence.ll?rev=302234&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/inter-error-bb-dependence.ll (added)
+++ polly/trunk/test/ScopInfo/inter-error-bb-dependence.ll Fri May  5 08:38:35 2017
@@ -0,0 +1,51 @@
+; RUN: opt %loadPolly -pass-remarks-analysis="polly-scops" -polly-scops -analyze < %s 2>&1 > /dev/null | FileCheck %s
+;
+; Error statements (%bb33) do not require their uses to be verified.
+; In this case it uses %tmp32 from %bb31 which is not available becase
+; %bb31 is an error statement as well.
+
+target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+
+declare noalias i8* @widget()
+
+declare void @quux()
+
+define void @func(i32 %tmp3, i32 %tmp7, i32 %tmp17, i32 %tmp26, i32 %tmp19) {
+bb:
+  br label %bb2
+
+bb2:                                              ; preds = %bb
+  %tmp4 = icmp eq i32 %tmp3, 0
+  br i1 %tmp4, label %bb5, label %bb16
+
+bb5:                                              ; preds = %bb2
+  %tmp8 = icmp eq i32 %tmp7, 0
+  br i1 %tmp8, label %bb16, label %bb36
+
+bb16:                                             ; preds = %bb5, %bb2
+  %tmp18 = icmp eq i32 %tmp17, 0
+  %tmp20 = icmp eq i32 %tmp19, 0
+  %tmp21 = or i1 %tmp18, %tmp20
+  br i1 %tmp21, label %bb31, label %bb25
+
+bb25:                                             ; preds = %bb25, %bb16
+  %tmp27 = icmp eq i32 %tmp26, 0
+  br i1 %tmp27, label %bb31, label %bb25
+
+bb31:                                             ; preds = %bb25, %bb16
+  %tmp32 = call noalias i8* @widget()
+  br label %bb33
+
+bb33:                                             ; preds = %bb31
+  call void @quux()
+  %tmp34 = icmp eq i8* %tmp32, null
+  br label %bb36
+
+bb36:                                             ; preds = %bb33, %bb5
+  ret void
+}
+
+
+; CHECK:      SCoP begins here.
+; CHECK-NEXT: Low complexity assumption:       {  : 1 = 0 }
+; CHECK-NEXT: SCoP ends here but was dismissed.




More information about the llvm-commits mailing list