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.

llvm-svn: 267404
This commit is contained in:
Johannes Doerfert 2016-04-25 13:37:24 +00:00
parent a4dd8ef40f
commit 517d8d2f94
3 changed files with 35 additions and 4 deletions

View File

@ -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;
}

View File

@ -1138,9 +1138,6 @@ void RegionGenerator::copyStmt(ScopStmt &Stmt, LoopToScevMapT &LTS,
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

View File

@ -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
}