1*35f70200SMichael Kruse; RUN: opt %loadPolly -polly-scops -polly-opt-isl -polly-codegen -polly-scops -polly-codegen -S < %s | FileCheck %s 2*35f70200SMichael Kruse; RUN: opt %loadPolly "-passes=scop(polly-opt-isl,polly-codegen,polly-codegen)" -S < %s | FileCheck %s 3*35f70200SMichael Kruse; RUN: opt %loadPolly "-passes=scop(polly-opt-isl,polly-codegen),scop(polly-codegen)" -S < %s | FileCheck %s 4*35f70200SMichael Kruse; 5*35f70200SMichael Kruse; llvm.org/PR34441 6*35f70200SMichael Kruse; Properly handle multiple -polly-scops/-polly-codegen in the same 7*35f70200SMichael Kruse; RegionPassManager. -polly-codegen must not reuse the -polly-ast analysis the 8*35f70200SMichael Kruse; was created for the first -polly-scops pass. 9*35f70200SMichael Kruse; The current solution is that only the first -polly-codegen is allowed to 10*35f70200SMichael Kruse; generate code, the second detects it is re-using an IslAst that belongs to a 11*35f70200SMichael Kruse; different ScopInfo. 12*35f70200SMichael Kruse; 13*35f70200SMichael Kruse; int a, b, c; 14*35f70200SMichael Kruse; 15*35f70200SMichael Kruse; int main () { 16*35f70200SMichael Kruse; while (a++) 17*35f70200SMichael Kruse; while (b) { 18*35f70200SMichael Kruse; c = 0; 19*35f70200SMichael Kruse; break; 20*35f70200SMichael Kruse; } 21*35f70200SMichael Kruse; return 0; 22*35f70200SMichael Kruse; } 23*35f70200SMichael Kruse; 24*35f70200SMichael Krusetarget datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 25*35f70200SMichael Kruse 26*35f70200SMichael Kruse@a = common global i32 0, align 4 27*35f70200SMichael Kruse@b = common global i32 0, align 4 28*35f70200SMichael Kruse@c = common global i32 0, align 4 29*35f70200SMichael Kruse 30*35f70200SMichael Kruse; Function Attrs: nounwind uwtable 31*35f70200SMichael Krusedefine i32 @main() { 32*35f70200SMichael Kruseentry: 33*35f70200SMichael Kruse %retval = alloca i32, align 4 34*35f70200SMichael Kruse store i32 0, i32* %retval, align 4 35*35f70200SMichael Kruse %.pre = load i32, i32* @a, align 4 36*35f70200SMichael Kruse br label %while.cond 37*35f70200SMichael Kruse 38*35f70200SMichael Krusewhile.cond: ; preds = %while.end, %entry 39*35f70200SMichael Kruse %0 = phi i32 [ %inc, %while.end ], [ %.pre, %entry ] 40*35f70200SMichael Kruse %inc = add nsw i32 %0, 1 41*35f70200SMichael Kruse store i32 %inc, i32* @a, align 4 42*35f70200SMichael Kruse %tobool = icmp ne i32 %0, 0 43*35f70200SMichael Kruse br i1 %tobool, label %while.body, label %while.end4 44*35f70200SMichael Kruse 45*35f70200SMichael Krusewhile.body: ; preds = %while.cond 46*35f70200SMichael Kruse %1 = load i32, i32* @b, align 4 47*35f70200SMichael Kruse %tobool2 = icmp ne i32 %1, 0 48*35f70200SMichael Kruse br i1 %tobool2, label %while.body3, label %while.end 49*35f70200SMichael Kruse 50*35f70200SMichael Krusewhile.body3: ; preds = %while.body 51*35f70200SMichael Kruse store i32 0, i32* @c, align 4 52*35f70200SMichael Kruse br label %while.end 53*35f70200SMichael Kruse 54*35f70200SMichael Krusewhile.end: ; preds = %while.body3, %while.body 55*35f70200SMichael Kruse br label %while.cond 56*35f70200SMichael Kruse 57*35f70200SMichael Krusewhile.end4: ; preds = %while.cond 58*35f70200SMichael Kruse ret i32 0 59*35f70200SMichael Kruse} 60*35f70200SMichael Kruse 61*35f70200SMichael Kruse 62*35f70200SMichael Kruse; CHECK: polly.start: 63*35f70200SMichael Kruse; CHECK-NOT: polly.start: 64