[JSON][PM] Port json import/export over to new pm
[polly-mirror.git] / test / ScopDetect / non-affine-loop.ll
blob5ec0187841d13fce689117b718b5bbd7fd812784
1 ; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \
2 ; RUN:     -polly-allow-nonaffine-loops=false \
3 ; RUN:     -analyze < %s | FileCheck %s --check-prefix=REJECTNONAFFINELOOPS
4 ; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \
5 ; RUN:     -polly-allow-nonaffine-loops=true \
6 ; RUN:     -analyze < %s | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS
7 ; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \
8 ; RUN:     -polly-allow-nonaffine-loops=false -polly-allow-nonaffine \
9 ; RUN:     -analyze < %s | FileCheck %s \
10 ; RUN:     --check-prefix=ALLOWNONAFFINEREGIONSANDACCESSES
11 ; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \
12 ; RUN:     -polly-allow-nonaffine-loops=true -polly-allow-nonaffine \
13 ; RUN:     -analyze < %s | FileCheck %s \
14 ; RUN:     --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES
15 ; RUN: opt %loadPolly -polly-process-unprofitable=false \
16 ; RUN:     -polly-detect -polly-allow-nonaffine-branches \
17 ; RUN:     -polly-allow-nonaffine-loops=true -polly-allow-nonaffine \
18 ; RUN:     -analyze < %s | FileCheck %s \
19 ; RUN:     --check-prefix=PROFIT
21 ; This function/region does contain a loop, however it is non-affine, hence the access
22 ; A[i] is also. Furthermore, it is the only loop, thus when we over approximate
23 ; non-affine loops __and__ accesses __and__ allow regins without a (affine) loop we will
24 ; detect it, otherwise we won't.
26 ;    void f(int *A) {
27 ;      for (int i = 0; i < A[i]; i++)
28 ;        A[-1]++;
29 ;    }
31 ; REJECTNONAFFINELOOPS-NOT:              Valid
32 ; ALLOWNONAFFINELOOPS-NOT:               Valid
33 ; ALLOWNONAFFINEREGIONSANDACCESSES-NOT:  Valid
34 ; ALLOWNONAFFINELOOPSANDACCESSES:        Valid
35 ; PROFIT-NOT:                            Valid
37 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
39 define void @f(i32* %A) {
40 bb:
41   br label %bb1
43 bb1:                                              ; preds = %bb9, %bb
44   %indvars.iv = phi i64 [ %indvars.iv.next, %bb9 ], [ 0, %bb ]
45   %tmp = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
46   %tmp2 = load i32, i32* %tmp, align 4
47   %tmp3 = sext i32 %tmp2 to i64
48   %tmp4 = icmp slt i64 %indvars.iv, %tmp3
49   br i1 %tmp4, label %bb5, label %bb10
51 bb5:                                              ; preds = %bb1
52   %tmp6 = getelementptr inbounds i32, i32* %A, i64 -1
53   %tmp7 = load i32, i32* %tmp6, align 4
54   %tmp8 = add nsw i32 %tmp7, 1
55   store i32 %tmp8, i32* %tmp6, align 4
56   br label %bb9
58 bb9:                                              ; preds = %bb5
59   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
60   br label %bb1
62 bb10:                                             ; preds = %bb1
63   ret void