summaryrefslogtreecommitdiff
path: root/polly/test/CodeGen/multiple-codegens.ll
blob: 3198dfc6c5afdfb39d48dcdd457626be832997d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
; RUN: opt %loadPolly -polly-scops -polly-opt-isl -polly-codegen -polly-scops -polly-codegen -S < %s | FileCheck %s
; RUN: opt %loadNPMPolly "-passes=scop(polly-opt-isl,polly-codegen,polly-codegen)" -S < %s | FileCheck %s
; RUN: opt %loadNPMPolly "-passes=scop(polly-opt-isl,polly-codegen),scop(polly-codegen)" -S < %s | FileCheck %s
;
; llvm.org/PR34441
; Properly handle multiple -polly-scops/-polly-codegen in the same
; RegionPassManager. -polly-codegen must not reuse the -polly-ast analysis the
; was created for the first -polly-scops pass.
; The current solution is that only the first -polly-codegen is allowed to
; generate code, the second detects it is re-using an IslAst that belongs to a
; different ScopInfo.
;
; int a, b, c;
;
; int main () {
;  while (a++)
;    while (b) {
;        c = 0;
;        break;
;      }
;  return 0;
; }
;
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"

@a = common global i32 0, align 4
@b = common global i32 0, align 4
@c = common global i32 0, align 4

; Function Attrs: nounwind uwtable
define i32 @main() {
entry:
  %retval = alloca i32, align 4
  store i32 0, i32* %retval, align 4
  %.pre = load i32, i32* @a, align 4
  br label %while.cond

while.cond:                                       ; preds = %while.end, %entry
  %0 = phi i32 [ %inc, %while.end ], [ %.pre, %entry ]
  %inc = add nsw i32 %0, 1
  store i32 %inc, i32* @a, align 4
  %tobool = icmp ne i32 %0, 0
  br i1 %tobool, label %while.body, label %while.end4

while.body:                                       ; preds = %while.cond
  %1 = load i32, i32* @b, align 4
  %tobool2 = icmp ne i32 %1, 0
  br i1 %tobool2, label %while.body3, label %while.end

while.body3:                                      ; preds = %while.body
  store i32 0, i32* @c, align 4
  br label %while.end

while.end:                                        ; preds = %while.body3, %while.body
  br label %while.cond

while.end4:                                       ; preds = %while.cond
  ret i32 0
}


; CHECK: polly.start:
; CHECK-NOT: polly.start: