1; RUN: opt %loadPolly -basic-aa -polly-detect -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=false -analyze < %s | FileCheck %s --check-prefix=REJECTNONAFFINELOOPS 2; RUN: opt %loadPolly -basic-aa -polly-detect -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -analyze < %s | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS 3; RUN: opt %loadPolly -basic-aa -polly-detect -polly-allow-nonaffine -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -analyze < %s | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES 4; RUN: opt %loadPolly -basic-aa -polly-detect -polly-process-unprofitable=false \ 5; RUN: -polly-allow-nonaffine -polly-allow-nonaffine-branches \ 6; RUN: -polly-allow-nonaffine-loops=true -analyze < %s \ 7; RUN: | FileCheck %s --check-prefix=PROFIT 8; 9; Here we have a non-affine loop but also a non-affine access which should 10; be rejected as long as -polly-allow-nonaffine isn't given. 11; 12; REJECTNONAFFINELOOPS-NOT: Valid 13; ALLOWNONAFFINELOOPS-NOT: Valid 14; ALLOWNONAFFINELOOPSANDACCESSES: Valid Region for Scop: bb1 => bb13 15; PROFIT-NOT: Valid 16; 17; void f(int * restrict A, int * restrict C) { 18; int j = 0; 19; for (int i = 0; i < 1024; i++) { 20; while ((j = C[j])) 21; A[j]++; 22; } 23; } 24; 25target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 26 27define void @f(i32* noalias %A, i32* noalias %C) { 28bb: 29 br label %bb1 30 31bb1: ; preds = %bb12, %bb 32 %indvars.iv = phi i64 [ %indvars.iv.next, %bb12 ], [ 0, %bb ] 33 %exitcond = icmp ne i64 %indvars.iv, 1024 34 br i1 %exitcond, label %bb2, label %bb13 35 36bb2: ; preds = %bb1 37 br label %bb3 38 39bb3: ; preds = %bb6, %bb2 40 %indvars.j = phi i32 [ %tmp4, %bb6 ], [ 0, %bb2 ] 41 %tmp = getelementptr inbounds i32, i32* %C, i32 %indvars.j 42 %tmp4 = load i32, i32* %tmp, align 4 43 %tmp5 = icmp eq i32 %tmp4, 0 44 br i1 %tmp5, label %bb11, label %bb6 45 46bb6: ; preds = %bb3 47 %tmp7 = sext i32 %tmp4 to i64 48 %tmp8 = getelementptr inbounds i32, i32* %A, i64 %tmp7 49 %tmp9 = load i32, i32* %tmp8, align 4 50 %tmp10 = add nsw i32 %tmp9, 1 51 store i32 %tmp10, i32* %tmp8, align 4 52 br label %bb3 53 54bb11: ; preds = %bb3 55 br label %bb12 56 57bb12: ; preds = %bb11 58 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 59 br label %bb1 60 61bb13: ; preds = %bb1 62 ret void 63} 64