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