[polly] r267404 - Check only loop control of loops that are part of the region

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 06:37:24 PDT 2016


Author: jdoerfert
Date: Mon Apr 25 08:37:24 2016
New Revision: 267404

URL: http://llvm.org/viewvc/llvm-project?rev=267404&view=rev
Log:
Check only loop control of loops that are part of the region

  This also removes a duplicated line of code in the region generator
  that caused a SPEC benchmark to fail with the new SCoPs.

Added:
    polly/trunk/test/Isl/CodeGen/loop_partially_in_scop.ll
Modified:
    polly/trunk/lib/Analysis/ScopDetection.cpp
    polly/trunk/lib/CodeGen/BlockGenerators.cpp

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=267404&r1=267403&r2=267404&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Mon Apr 25 08:37:24 2016
@@ -1240,7 +1240,8 @@ bool ScopDetection::allBlocksValid(Detec
 
   for (const BasicBlock *BB : CurRegion.blocks()) {
     Loop *L = LI->getLoopFor(BB);
-    if (L && L->getHeader() == BB && (!isValidLoop(L, Context) && !KeepGoing))
+    if (L && L->getHeader() == BB && CurRegion.contains(L) &&
+        (!isValidLoop(L, Context) && !KeepGoing))
       return false;
   }
 

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=267404&r1=267403&r2=267404&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Mon Apr 25 08:37:24 2016
@@ -1138,9 +1138,6 @@ void RegionGenerator::copyStmt(ScopStmt
     BasicBlock *BBCopy = splitBB(BB);
     BasicBlock *BBCopyIDom = repairDominance(BB, BBCopy);
 
-    // In order to remap PHI nodes we store also basic block mappings.
-    BlockMap[BB] = BBCopy;
-
     // Get the mapping for this block and initialize it with either the scalar
     // loads from the generated entering block (which dominates all blocks of
     // this subregion) or the maps of the immediate dominator, if part of the

Added: polly/trunk/test/Isl/CodeGen/loop_partially_in_scop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/loop_partially_in_scop.ll?rev=267404&view=auto
==============================================================================
--- polly/trunk/test/Isl/CodeGen/loop_partially_in_scop.ll (added)
+++ polly/trunk/test/Isl/CodeGen/loop_partially_in_scop.ll Mon Apr 25 08:37:24 2016
@@ -0,0 +1,33 @@
+; RUN: opt %loadPolly -S -polly-codegen < %s | FileCheck %s
+;
+; Verify we do not crash for this test case.
+;
+; CHECK: polly.start
+;
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+; Function Attrs: nounwind uwtable
+define void @compressStream() #0 {
+entry:
+  br label %if.else
+
+if.else:                                          ; preds = %entry
+  br label %do.body.i
+
+do.body.i:                                        ; preds = %for.cond.i.i.6, %for.cond.i.i.4, %do.body.i, %if.else
+  %0 = phi i32 [ undef, %if.else ], [ 0, %for.cond.i.i.6 ], [ %div.i.i.2, %for.cond.i.i.4 ], [ %div.i.i.2, %do.body.i ]
+  %add.i.i.2 = or i32 undef, undef
+  %div.i.i.2 = udiv i32 %add.i.i.2, 10
+  %1 = trunc i32 undef to i8
+  %2 = icmp eq i8 %1, 0
+  br i1 %2, label %for.cond.i.i.4, label %do.body.i
+
+for.cond.i.i.4:                                   ; preds = %do.body.i
+  br i1 undef, label %for.cond.i.i.6, label %do.body.i
+
+for.cond.i.i.6:                                   ; preds = %for.cond.i.i.4
+  br i1 undef, label %for.cond.i.i.7, label %do.body.i
+
+for.cond.i.i.7:                                   ; preds = %for.cond.i.i.6
+  unreachable
+}




More information about the llvm-commits mailing list