Tobias Grosser | f4ee371 | 2015-10-06 15:36:44 +0000 | [diff] [blame] | 1 | ; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \ |
| 2 | ; RUN: -polly-allow-nonaffine-loops=false \ |
Tobias Grosser | ed21a1f | 2015-08-27 16:55:18 +0000 | [diff] [blame] | 3 | ; RUN: -analyze < %s | FileCheck %s --check-prefix=REJECTNONAFFINELOOPS |
Tobias Grosser | f4ee371 | 2015-10-06 15:36:44 +0000 | [diff] [blame] | 4 | ; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \ |
| 5 | ; RUN: -polly-allow-nonaffine-loops=true \ |
Tobias Grosser | ed21a1f | 2015-08-27 16:55:18 +0000 | [diff] [blame] | 6 | ; RUN: -analyze < %s | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS |
Tobias Grosser | f4ee371 | 2015-10-06 15:36:44 +0000 | [diff] [blame] | 7 | ; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \ |
Johannes Doerfert | f61df69 | 2015-10-04 14:56:08 +0000 | [diff] [blame] | 8 | ; RUN: -polly-allow-nonaffine-loops=false -polly-allow-nonaffine \ |
| 9 | ; RUN: -analyze < %s | FileCheck %s \ |
| 10 | ; RUN: --check-prefix=ALLOWNONAFFINEREGIONSANDACCESSES |
Tobias Grosser | f4ee371 | 2015-10-06 15:36:44 +0000 | [diff] [blame] | 11 | ; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \ |
Tobias Grosser | ed21a1f | 2015-08-27 16:55:18 +0000 | [diff] [blame] | 12 | ; RUN: -polly-allow-nonaffine-loops=true -polly-allow-nonaffine \ |
Tobias Grosser | 02e6589 | 2015-09-08 19:46:41 +0000 | [diff] [blame] | 13 | ; RUN: -analyze < %s | FileCheck %s \ |
Tobias Grosser | ed21a1f | 2015-08-27 16:55:18 +0000 | [diff] [blame] | 14 | ; RUN: --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES |
Tobias Grosser | 575aca8 | 2015-10-06 16:10:29 +0000 | [diff] [blame] | 15 | ; RUN: opt %loadPolly -polly-process-unprofitable=false \ |
Tobias Grosser | 935f62c | 2015-10-06 15:19:35 +0000 | [diff] [blame] | 16 | ; RUN: -polly-detect -polly-allow-nonaffine-branches \ |
Johannes Doerfert | f61df69 | 2015-10-04 14:56:08 +0000 | [diff] [blame] | 17 | ; RUN: -polly-allow-nonaffine-loops=true -polly-allow-nonaffine \ |
| 18 | ; RUN: -analyze < %s | FileCheck %s \ |
| 19 | ; RUN: --check-prefix=PROFIT |
Johannes Doerfert | f8206cf | 2015-04-12 22:58:40 +0000 | [diff] [blame] | 20 | ; |
| 21 | ; This function/region does contain a loop, however it is non-affine, hence the access |
| 22 | ; A[i] is also. Furthermore, it is the only loop, thus when we over approximate |
| 23 | ; non-affine loops __and__ accesses __and__ allow regins without a (affine) loop we will |
| 24 | ; detect it, otherwise we won't. |
| 25 | ; |
| 26 | ; void f(int *A) { |
| 27 | ; for (int i = 0; i < A[i]; i++) |
| 28 | ; A[-1]++; |
| 29 | ; } |
| 30 | ; |
Johannes Doerfert | f61df69 | 2015-10-04 14:56:08 +0000 | [diff] [blame] | 31 | ; REJECTNONAFFINELOOPS-NOT: Valid |
| 32 | ; ALLOWNONAFFINELOOPS-NOT: Valid |
| 33 | ; ALLOWNONAFFINEREGIONSANDACCESSES-NOT: Valid |
| 34 | ; ALLOWNONAFFINELOOPSANDACCESSES: Valid |
| 35 | ; PROFIT-NOT: Valid |
Johannes Doerfert | f8206cf | 2015-04-12 22:58:40 +0000 | [diff] [blame] | 36 | ; |
| 37 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 38 | |
| 39 | define void @f(i32* %A) { |
| 40 | bb: |
| 41 | br label %bb1 |
| 42 | |
| 43 | bb1: ; preds = %bb9, %bb |
| 44 | %indvars.iv = phi i64 [ %indvars.iv.next, %bb9 ], [ 0, %bb ] |
| 45 | %tmp = getelementptr inbounds i32, i32* %A, i64 %indvars.iv |
| 46 | %tmp2 = load i32, i32* %tmp, align 4 |
| 47 | %tmp3 = sext i32 %tmp2 to i64 |
| 48 | %tmp4 = icmp slt i64 %indvars.iv, %tmp3 |
| 49 | br i1 %tmp4, label %bb5, label %bb10 |
| 50 | |
| 51 | bb5: ; preds = %bb1 |
| 52 | %tmp6 = getelementptr inbounds i32, i32* %A, i64 -1 |
| 53 | %tmp7 = load i32, i32* %tmp6, align 4 |
| 54 | %tmp8 = add nsw i32 %tmp7, 1 |
| 55 | store i32 %tmp8, i32* %tmp6, align 4 |
| 56 | br label %bb9 |
| 57 | |
| 58 | bb9: ; preds = %bb5 |
| 59 | %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 60 | br label %bb1 |
| 61 | |
| 62 | bb10: ; preds = %bb1 |
| 63 | ret void |
| 64 | } |