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.
27 ; for (int i = 0; i < A[i]; i++)
31 ; REJECTNONAFFINELOOPS-NOT: Valid
32 ; ALLOWNONAFFINELOOPS-NOT: Valid
33 ; ALLOWNONAFFINEREGIONSANDACCESSES-NOT: Valid
34 ; ALLOWNONAFFINELOOPSANDACCESSES: Valid
37 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
39 define void @f(i32* %A) {
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
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
59 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1