diff options
-rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 3 | ||||
-rw-r--r-- | polly/lib/CodeGen/BlockGenerators.cpp | 3 | ||||
-rw-r--r-- | polly/test/Isl/CodeGen/loop_partially_in_scop.ll | 33 |
3 files changed, 35 insertions, 4 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index c6676ff1dd9..2e1caf51b10 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -1240,7 +1240,8 @@ bool ScopDetection::allBlocksValid(DetectionContext &Context) const { 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; } diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index e980d375a17..99db6bc0263 100644 --- a/polly/lib/CodeGen/BlockGenerators.cpp +++ b/polly/lib/CodeGen/BlockGenerators.cpp @@ -1138,9 +1138,6 @@ void RegionGenerator::copyStmt(ScopStmt &Stmt, LoopToScevMapT <S, 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 diff --git a/polly/test/Isl/CodeGen/loop_partially_in_scop.ll b/polly/test/Isl/CodeGen/loop_partially_in_scop.ll new file mode 100644 index 00000000000..cf670e39926 --- /dev/null +++ b/polly/test/Isl/CodeGen/loop_partially_in_scop.ll @@ -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 +} |