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