• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-scops \
2; RUN:     -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops \
3; RUN:     -analyze < %s | FileCheck %s
4; RUN: opt %loadPolly -polly-scops -polly-allow-nonaffine-branches \
5; RUN:     -polly-process-unprofitable=false \
6; RUN:     -polly-allow-nonaffine-loops -analyze < %s | FileCheck %s \
7; RUN:     --check-prefix=PROFIT
8
9
10; RUN: opt %loadPolly -polly-scops -polly-detect-reductions \
11; RUN:                -polly-allow-nonaffine-branches \
12; RUN:                \
13; RUN:                -polly-allow-nonaffine-loops -analyze < %s \
14; RUN:                -polly-detect-reductions=false \
15; RUN: | FileCheck %s -check-prefix=NO-REDUCTION
16;
17;    void f(int *A, int *C) {
18;      for (int i = 0; i < 1024; i++) {
19;        while (C[i])
20;          A[i]++;
21;      }
22;    }
23;
24; CHECK:      Function: f
25; CHECK-NEXT: Region: %bb1---%bb12
26; CHECK-NEXT: Max Loop Depth:  1
27; CHECK-NEXT: Invariant Accesses: {
28; CHECK-NEXT: }
29; CHECK-NEXT: Context:
30; CHECK-NEXT: {  :  }
31; CHECK-NEXT: Assumed Context:
32; CHECK-NEXT: {  :  }
33; CHECK-NEXT: Invalid Context:
34; CHECK-NEXT: {  : false }
35; CHECK-NEXT: Arrays {
36; CHECK-NEXT:     i32 MemRef_C[*]; // Element size 4
37; CHECK-NEXT:     i32 MemRef_A[*]; // Element size 4
38; CHECK-NEXT: }
39; CHECK-NEXT: Arrays (Bounds as pw_affs) {
40; CHECK-NEXT:     i32 MemRef_C[*]; // Element size 4
41; CHECK-NEXT:     i32 MemRef_A[*]; // Element size 4
42; CHECK-NEXT: }
43; CHECK-NEXT: Alias Groups (1):
44; CHECK-NEXT:     {{\[\[}} <{ MemRef_C[(0)] }, { MemRef_C[(1024)] }> <{ MemRef_A[(0)] }, { MemRef_A[(1024)] }> {{\]\]}}
45; CHECK-NEXT: Statements {
46; CHECK-NEXT:     Stmt_bb3__TO__bb10
47; CHECK-NEXT:         Domain :=
48; CHECK-NEXT:             { Stmt_bb3__TO__bb10[i0] : 0 <= i0 <= 1023 };
49; CHECK-NEXT:         Schedule :=
50; CHECK-NEXT:             { Stmt_bb3__TO__bb10[i0] -> [i0] };
51; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 0]
52; CHECK-NEXT:             { Stmt_bb3__TO__bb10[i0] -> MemRef_C[i0] };
53; CHECK-NEXT:         ReadAccess :=    [Reduction Type: +] [Scalar: 0]
54; CHECK-NEXT:             { Stmt_bb3__TO__bb10[i0] -> MemRef_A[i0] };
55; CHECK-NEXT:         MayWriteAccess :=    [Reduction Type: +] [Scalar: 0]
56; CHECK-NEXT:             { Stmt_bb3__TO__bb10[i0] -> MemRef_A[i0] };
57; CHECK-NEXT: }
58
59; PROFIT-NOT: Statements
60
61; NO-REDUCTION-NOT: Reduction Type: +
62
63target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
64
65define void @f(i32* %A, i32* %C) {
66bb:
67  br label %bb1
68
69bb1:                                              ; preds = %bb11, %bb
70  %indvars.iv = phi i64 [ %indvars.iv.next, %bb11 ], [ 0, %bb ]
71  %exitcond = icmp ne i64 %indvars.iv, 1024
72  br i1 %exitcond, label %bb2, label %bb12
73
74bb2:                                              ; preds = %bb1
75  br label %bb3
76
77bb3:                                              ; preds = %bb6, %bb2
78  %tmp = getelementptr inbounds i32, i32* %C, i64 %indvars.iv
79  %tmp4 = load i32, i32* %tmp, align 4
80  %tmp5 = icmp eq i32 %tmp4, 0
81  br i1 %tmp5, label %bb10, label %bb6
82
83bb6:                                              ; preds = %bb3
84  %tmp7 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
85  %tmp8 = load i32, i32* %tmp7, align 4
86  %tmp9 = add nsw i32 %tmp8, 1
87  store i32 %tmp9, i32* %tmp7, align 4
88  br label %bb3
89
90bb10:                                             ; preds = %bb3
91  br label %bb11
92
93bb11:                                             ; preds = %bb10
94  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
95  br label %bb1
96
97bb12:                                             ; preds = %bb1
98  ret void
99}
100