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 6; 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. 11; 12; void f(int *A) { 13; for (int i = 0; i < A[i]; i++) 14; A[-1]++; 15; } 16; 17; REJECTNONAFFINELOOPS-NOT: Valid 18; ALLOWNONAFFINELOOPS-NOT: Valid 19; ALLOWNONAFFINEREGIONSANDACCESSES-NOT: Valid 20; ALLOWNONAFFINELOOPSANDACCESSES: Valid 21; PROFIT-NOT: Valid 22; 23target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 24 25define void @f(ptr %A) { 26bb: 27 br label %bb1 28 29bb1: ; 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 36 37bb5: ; preds = %bb1 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 42 br label %bb9 43 44bb9: ; preds = %bb5 45 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 46 br label %bb1 47 48bb10: ; preds = %bb1 49 ret void 50} 51