51 lines · plain
1; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=false '-passes=polly-custom<detect>' -polly-print-detect -disable-output < %s 2>&1 | FileCheck %s --check-prefix=REJECTNONAFFINELOOPS2; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true '-passes=polly-custom<detect>' -polly-print-detect -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS3; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=false -polly-allow-nonaffine '-passes=polly-custom<detect>' -polly-print-detect -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINEREGIONSANDACCESSES4; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -polly-allow-nonaffine '-passes=polly-custom<detect>' -polly-print-detect -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES5; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -polly-allow-nonaffine -polly-process-unprofitable=false '-passes=polly-custom<detect>' -polly-print-detect -disable-output < %s 2>&1 | FileCheck %s --check-prefix=PROFIT6;7; This function/region does contain a loop, however it is non-affine, hence the access8; A[i] is also. Furthermore, it is the only loop, thus when we over approximate9; non-affine loops __and__ accesses __and__ allow regions without a (affine) loop we will10; 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: Valid18; ALLOWNONAFFINELOOPS-NOT: Valid19; ALLOWNONAFFINEREGIONSANDACCESSES-NOT: Valid20; ALLOWNONAFFINELOOPSANDACCESSES: Valid21; PROFIT-NOT: Valid22;23target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"24 25define void @f(ptr %A) {26bb:27 br label %bb128 29bb1: ; preds = %bb9, %bb30 %indvars.iv = phi i64 [ %indvars.iv.next, %bb9 ], [ 0, %bb ]31 %tmp = getelementptr inbounds i32, ptr %A, i64 %indvars.iv32 %tmp2 = load i32, ptr %tmp, align 433 %tmp3 = sext i32 %tmp2 to i6434 %tmp4 = icmp slt i64 %indvars.iv, %tmp335 br i1 %tmp4, label %bb5, label %bb1036 37bb5: ; preds = %bb138 %tmp6 = getelementptr inbounds i32, ptr %A, i64 -139 %tmp7 = load i32, ptr %tmp6, align 440 %tmp8 = add nsw i32 %tmp7, 141 store i32 %tmp8, ptr %tmp6, align 442 br label %bb943 44bb9: ; preds = %bb545 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 146 br label %bb147 48bb10: ; preds = %bb149 ret void50}51