1 ; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=false '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=REJECTNONAFFINELOOPS
2 ; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS
3 ; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=false -polly-allow-nonaffine '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINEREGIONSANDACCESSES
4 ; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -polly-allow-nonaffine '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES
5 ; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -polly-allow-nonaffine -polly-process-unprofitable=false '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=PROFIT
7 ; This function/region does contain a loop, however it is non-affine, hence the access
8 ; A[i] is also. Furthermore, it is the only loop, thus when we over approximate
9 ; non-affine loops __and__ accesses __and__ allow regions without a (affine) loop we will
10 ; detect it, otherwise we won't.
13 ; for (int i = 0; i < A[i]; i++)
17 ; REJECTNONAFFINELOOPS-NOT: Valid
18 ; ALLOWNONAFFINELOOPS-NOT: Valid
19 ; ALLOWNONAFFINEREGIONSANDACCESSES-NOT: Valid
20 ; ALLOWNONAFFINELOOPSANDACCESSES: Valid
23 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25 define void @f(ptr %A) {
29 bb1: ; preds = %bb9, %bb
30 %indvars.iv = phi i64 [ %indvars.iv.next, %bb9 ], [ 0, %bb ]
31 %tmp = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
32 %tmp2 = load i32, ptr %tmp, align 4
33 %tmp3 = sext i32 %tmp2 to i64
34 %tmp4 = icmp slt i64 %indvars.iv, %tmp3
35 br i1 %tmp4, label %bb5, label %bb10
38 %tmp6 = getelementptr inbounds i32, ptr %A, i64 -1
39 %tmp7 = load i32, ptr %tmp6, align 4
40 %tmp8 = add nsw i32 %tmp7, 1
41 store i32 %tmp8, ptr %tmp6, align 4
45 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1