1 ; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa -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 -aa-pipeline=basic-aa -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 -aa-pipeline=basic-aa -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
4 ; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa -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 ; Here we have a non-affine loop but also a non-affine access which should
7 ; be rejected as long as -polly-allow-nonaffine isn't given.
9 ; REJECTNONAFFINELOOPS-NOT: Valid
10 ; ALLOWNONAFFINELOOPS-NOT: Valid
11 ; ALLOWNONAFFINELOOPSANDACCESSES: Valid Region for Scop: bb1 => bb13
14 ; void f(int * restrict A, int * restrict C) {
16 ; for (int i = 0; i < 1024; i++) {
22 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
24 define void @f(ptr noalias %A, ptr noalias %C) {
28 bb1: ; preds = %bb12, %bb
29 %indvars.iv = phi i64 [ %indvars.iv.next, %bb12 ], [ 0, %bb ]
30 %exitcond = icmp ne i64 %indvars.iv, 1024
31 br i1 %exitcond, label %bb2, label %bb13
36 bb3: ; preds = %bb6, %bb2
37 %indvars.j = phi i32 [ %tmp4, %bb6 ], [ 0, %bb2 ]
38 %tmp = getelementptr inbounds i32, ptr %C, i32 %indvars.j
39 %tmp4 = load i32, ptr %tmp, align 4
40 %tmp5 = icmp eq i32 %tmp4, 0
41 br i1 %tmp5, label %bb11, label %bb6
44 %tmp7 = sext i32 %tmp4 to i64
45 %tmp8 = getelementptr inbounds i32, ptr %A, i64 %tmp7
46 %tmp9 = load i32, ptr %tmp8, align 4
47 %tmp10 = add nsw i32 %tmp9, 1
48 store i32 %tmp10, ptr %tmp8, align 4
55 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1