135f70200SMichael Kruse; RUN: opt %loadPolly -polly-scops -polly-opt-isl -polly-codegen -polly-scops -polly-codegen -S < %s | FileCheck %s 2*c80198b3SWael Yehia; RUN: opt %loadNPMPolly "-passes=scop(polly-opt-isl,polly-codegen,polly-codegen)" -S < %s | FileCheck %s 3*c80198b3SWael Yehia; RUN: opt %loadNPMPolly "-passes=scop(polly-opt-isl,polly-codegen),scop(polly-codegen)" -S < %s | FileCheck %s 435f70200SMichael Kruse; 535f70200SMichael Kruse; llvm.org/PR34441 635f70200SMichael Kruse; Properly handle multiple -polly-scops/-polly-codegen in the same 735f70200SMichael Kruse; RegionPassManager. -polly-codegen must not reuse the -polly-ast analysis the 835f70200SMichael Kruse; was created for the first -polly-scops pass. 935f70200SMichael Kruse; The current solution is that only the first -polly-codegen is allowed to 1035f70200SMichael Kruse; generate code, the second detects it is re-using an IslAst that belongs to a 1135f70200SMichael Kruse; different ScopInfo. 1235f70200SMichael Kruse; 1335f70200SMichael Kruse; int a, b, c; 1435f70200SMichael Kruse; 1535f70200SMichael Kruse; int main () { 1635f70200SMichael Kruse; while (a++) 1735f70200SMichael Kruse; while (b) { 1835f70200SMichael Kruse; c = 0; 1935f70200SMichael Kruse; break; 2035f70200SMichael Kruse; } 2135f70200SMichael Kruse; return 0; 2235f70200SMichael Kruse; } 2335f70200SMichael Kruse; 2435f70200SMichael Krusetarget datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 2535f70200SMichael Kruse 2635f70200SMichael Kruse@a = common global i32 0, align 4 2735f70200SMichael Kruse@b = common global i32 0, align 4 2835f70200SMichael Kruse@c = common global i32 0, align 4 2935f70200SMichael Kruse 3035f70200SMichael Kruse; Function Attrs: nounwind uwtable 3135f70200SMichael Krusedefine i32 @main() { 3235f70200SMichael Kruseentry: 3335f70200SMichael Kruse %retval = alloca i32, align 4 3435f70200SMichael Kruse store i32 0, i32* %retval, align 4 3535f70200SMichael Kruse %.pre = load i32, i32* @a, align 4 3635f70200SMichael Kruse br label %while.cond 3735f70200SMichael Kruse 3835f70200SMichael Krusewhile.cond: ; preds = %while.end, %entry 3935f70200SMichael Kruse %0 = phi i32 [ %inc, %while.end ], [ %.pre, %entry ] 4035f70200SMichael Kruse %inc = add nsw i32 %0, 1 4135f70200SMichael Kruse store i32 %inc, i32* @a, align 4 4235f70200SMichael Kruse %tobool = icmp ne i32 %0, 0 4335f70200SMichael Kruse br i1 %tobool, label %while.body, label %while.end4 4435f70200SMichael Kruse 4535f70200SMichael Krusewhile.body: ; preds = %while.cond 4635f70200SMichael Kruse %1 = load i32, i32* @b, align 4 4735f70200SMichael Kruse %tobool2 = icmp ne i32 %1, 0 4835f70200SMichael Kruse br i1 %tobool2, label %while.body3, label %while.end 4935f70200SMichael Kruse 5035f70200SMichael Krusewhile.body3: ; preds = %while.body 5135f70200SMichael Kruse store i32 0, i32* @c, align 4 5235f70200SMichael Kruse br label %while.end 5335f70200SMichael Kruse 5435f70200SMichael Krusewhile.end: ; preds = %while.body3, %while.body 5535f70200SMichael Kruse br label %while.cond 5635f70200SMichael Kruse 5735f70200SMichael Krusewhile.end4: ; preds = %while.cond 5835f70200SMichael Kruse ret i32 0 5935f70200SMichael Kruse} 6035f70200SMichael Kruse 6135f70200SMichael Kruse 6235f70200SMichael Kruse; CHECK: polly.start: 6335f70200SMichael Kruse; CHECK-NOT: polly.start: 64