blob: 5ec0187841d13fce689117b718b5bbd7fd812784 [file] [log] [blame]
Tobias Grosserf4ee3712015-10-06 15:36:44 +00001; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \
2; RUN: -polly-allow-nonaffine-loops=false \
Tobias Grossered21a1f2015-08-27 16:55:18 +00003; RUN: -analyze < %s | FileCheck %s --check-prefix=REJECTNONAFFINELOOPS
Tobias Grosserf4ee3712015-10-06 15:36:44 +00004; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \
5; RUN: -polly-allow-nonaffine-loops=true \
Tobias Grossered21a1f2015-08-27 16:55:18 +00006; RUN: -analyze < %s | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS
Tobias Grosserf4ee3712015-10-06 15:36:44 +00007; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \
Johannes Doerfertf61df692015-10-04 14:56:08 +00008; RUN: -polly-allow-nonaffine-loops=false -polly-allow-nonaffine \
9; RUN: -analyze < %s | FileCheck %s \
10; RUN: --check-prefix=ALLOWNONAFFINEREGIONSANDACCESSES
Tobias Grosserf4ee3712015-10-06 15:36:44 +000011; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \
Tobias Grossered21a1f2015-08-27 16:55:18 +000012; RUN: -polly-allow-nonaffine-loops=true -polly-allow-nonaffine \
Tobias Grosser02e65892015-09-08 19:46:41 +000013; RUN: -analyze < %s | FileCheck %s \
Tobias Grossered21a1f2015-08-27 16:55:18 +000014; RUN: --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES
Tobias Grosser575aca82015-10-06 16:10:29 +000015; RUN: opt %loadPolly -polly-process-unprofitable=false \
Tobias Grosser935f62c2015-10-06 15:19:35 +000016; RUN: -polly-detect -polly-allow-nonaffine-branches \
Johannes Doerfertf61df692015-10-04 14:56:08 +000017; RUN: -polly-allow-nonaffine-loops=true -polly-allow-nonaffine \
18; RUN: -analyze < %s | FileCheck %s \
19; RUN: --check-prefix=PROFIT
Johannes Doerfertf8206cf2015-04-12 22:58:40 +000020;
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 Doerfertf61df692015-10-04 14:56:08 +000031; REJECTNONAFFINELOOPS-NOT: Valid
32; ALLOWNONAFFINELOOPS-NOT: Valid
33; ALLOWNONAFFINEREGIONSANDACCESSES-NOT: Valid
34; ALLOWNONAFFINELOOPSANDACCESSES: Valid
35; PROFIT-NOT: Valid
Johannes Doerfertf8206cf2015-04-12 22:58:40 +000036;
37target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
38
39define void @f(i32* %A) {
40bb:
41 br label %bb1
42
43bb1: ; 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
51bb5: ; 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
58bb9: ; preds = %bb5
59 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
60 br label %bb1
61
62bb10: ; preds = %bb1
63 ret void
64}