1 ; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine-branches \
2 ; RUN: -polly-allow-nonaffine-loops=false \
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 \
6 ; RUN: -analyze < %s | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS
7 ; RUN: opt %loadPolly -polly-detect -polly-allow-nonaffine \
8 ; RUN: -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true \
9 ; RUN: -analyze < %s | FileCheck %s \
10 ; RUN: --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES
12 ; Here we have a non-affine loop (in the context of the loop nest)
13 ; and also a non-affine access (A[k]). While we can always detect the
14 ; innermost loop as a SCoP of depth 1, we have to reject the loop nest if not
15 ; both, non-affine loops as well as non-affine accesses are allowed.
17 ; REJECTNONAFFINELOOPS: Valid Region for Scop: bb15 => bb13
18 ; REJECTNONAFFINELOOPS-NOT: Valid
19 ; ALLOWNONAFFINELOOPS: Valid Region for Scop: bb15 => bb13
20 ; ALLOWNONAFFINELOOPS-NOT: Valid
21 ; ALLOWNONAFFINELOOPSANDACCESSES: Valid Region for Scop: bb11 => bb29
24 ; for (int i = 0; i < 1024; i++)
25 ; for (int j = 0; j < 1024; j++)
26 ; for (int k = 0; k < i * j; k++)
27 ; A[k] += A[i] + A[j];
30 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
32 define void @f(i32* %A) {
36 bb11: ; preds = %bb28, %bb
37 %indvars.iv8 = phi i64 [ %indvars.iv.next9, %bb28 ], [ 0, %bb ]
38 %indvars.iv1 = phi i32 [ %indvars.iv.next2, %bb28 ], [ 0, %bb ]
39 %exitcond10 = icmp ne i64 %indvars.iv8, 1024
40 br i1 %exitcond10, label %bb12, label %bb29
45 bb13: ; preds = %bb26, %bb12
46 %indvars.iv5 = phi i64 [ %indvars.iv.next6, %bb26 ], [ 0, %bb12 ]
47 %indvars.iv3 = phi i32 [ %indvars.iv.next4, %bb26 ], [ 0, %bb12 ]
48 %exitcond7 = icmp ne i64 %indvars.iv5, 1024
49 br i1 %exitcond7, label %bb14, label %bb27
54 bb15: ; preds = %bb24, %bb14
55 %indvars.iv = phi i64 [ %indvars.iv.next, %bb24 ], [ 0, %bb14 ]
56 %lftr.wideiv = trunc i64 %indvars.iv to i32
57 %exitcond = icmp ne i32 %lftr.wideiv, %indvars.iv3
58 br i1 %exitcond, label %bb16, label %bb25
61 %tmp = getelementptr inbounds i32, i32* %A, i64 %indvars.iv8
62 %tmp17 = load i32, i32* %tmp, align 4
63 %tmp18 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv5
64 %tmp19 = load i32, i32* %tmp18, align 4
65 %tmp20 = add nsw i32 %tmp17, %tmp19
66 %tmp21 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
67 %tmp22 = load i32, i32* %tmp21, align 4
68 %tmp23 = add nsw i32 %tmp22, %tmp20
69 store i32 %tmp23, i32* %tmp21, align 4
73 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
80 %indvars.iv.next6 = add nuw nsw i64 %indvars.iv5, 1
81 %indvars.iv.next4 = add nuw nsw i32 %indvars.iv3, %indvars.iv1
88 %indvars.iv.next9 = add nuw nsw i64 %indvars.iv8, 1
89 %indvars.iv.next2 = add nuw nsw i32 %indvars.iv1, 1