1 ; RUN: opt %loadPolly -polly-scops -analyze < %s | \
2 ; RUN: FileCheck %s -check-prefix=NONAFFINE
3 ; RUN: opt %loadPolly -polly-scops -analyze \
4 ; RUN: -polly-allow-nonaffine-branches=false < %s | \
5 ; RUN: FileCheck %s -check-prefix=NO-NONEAFFINE
7 ; NONAFFINE: Statements {
8 ; NONAFFINE-NEXT: Stmt_loop
9 ; NONAFFINE-NEXT: Domain :=
10 ; NONAFFINE-NEXT: [p] -> { Stmt_loop[0] : p = 100 };
11 ; NONAFFINE-NEXT: Schedule :=
12 ; NONAFFINE-NEXT: [p] -> { Stmt_loop[i0] -> [0, 0] };
13 ; NONAFFINE-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
14 ; NONAFFINE-NEXT: [p] -> { Stmt_loop[i0] -> MemRef_A[0] };
15 ; NONAFFINE-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
16 ; NONAFFINE-NEXT: [p] -> { Stmt_loop[i0] -> MemRef_cmp[] };
17 ; NONAFFINE-NEXT: Stmt_branch__TO__end
18 ; NONAFFINE-NEXT: Domain :=
19 ; NONAFFINE-NEXT: [p] -> { Stmt_branch__TO__end[] : p = 100 };
20 ; NONAFFINE-NEXT: Schedule :=
21 ; NONAFFINE-NEXT: [p] -> { Stmt_branch__TO__end[] -> [1, 0] };
22 ; NONAFFINE-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
23 ; NONAFFINE-NEXT: [p] -> { Stmt_branch__TO__end[] -> MemRef_cmp[] };
24 ; NONAFFINE-NEXT: MayWriteAccess := [Reduction Type: NONE] [Scalar: 0]
25 ; NONAFFINE-NEXT: [p] -> { Stmt_branch__TO__end[] -> MemRef_A[0] };
28 ; NO-NONEAFFINE: Statements {
29 ; NO-NONEAFFINE-NEXT: Stmt_then
30 ; NO-NONEAFFINE-NEXT: Domain :=
31 ; NO-NONEAFFINE-NEXT: [p_0, p] -> { Stmt_then[] : p >= 2 + p_0 or p <= p_0 };
32 ; NO-NONEAFFINE-NEXT: Schedule :=
33 ; NO-NONEAFFINE-NEXT: [p_0, p] -> { Stmt_then[] -> [] };
34 ; NO-NONEAFFINE-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
35 ; NO-NONEAFFINE-NEXT: [p_0, p] -> { Stmt_then[] -> MemRef_A[0] };
36 ; NO-NONEAFFINE-NEXT: }
38 ; NO-NONEAFFINE: Statements {
39 ; NO-NONEAFFINE-NEXT: Stmt_loop
40 ; NO-NONEAFFINE-NEXT: Domain :=
41 ; NO-NONEAFFINE-NEXT: [p] -> { Stmt_loop[0] : p = 100 };
42 ; NO-NONEAFFINE-NEXT: Schedule :=
43 ; NO-NONEAFFINE-NEXT: [p] -> { Stmt_loop[i0] -> [0] };
44 ; NO-NONEAFFINE-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
45 ; NO-NONEAFFINE-NEXT: [p] -> { Stmt_loop[i0] -> MemRef_A[0] };
46 ; NO-NONEAFFINE-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
47 ; NO-NONEAFFINE-NEXT: [p] -> { Stmt_loop[i0] -> MemRef_cmp[] };
48 ; NO-NONEAFFINE-NEXT: }
50 ; Verify that this test case does not crash -polly-scops. The problem in
51 ; this test case is that the branch instruction in %branch references
52 ; a scalar evolution expression for which no useful value can be computed at the
53 ; location %branch, as the loop %loop does not terminate. At some point, we
54 ; did not identify the branch condition as non-affine during scop detection.
55 ; This test verifies that we either model the branch condition as non-affine
56 ; region or only detect a smaller region if non-affine conditions are not
59 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
60 target triple = "aarch64--linux-android"
62 define void @f(i16 %event, i8 %p, float* %A) {
67 %indvar = phi i8 [ 0, %entry ], [ %indvar.next, %loop ]
68 %indvar.next = add i8 %indvar, 1
69 store float 1.0, float* %A
70 %cmp = icmp eq i8 %indvar.next, %p
71 %possibly_infinite = icmp eq i8 100, %p
72 br i1 %possibly_infinite, label %branch, label %loop
75 br i1 %cmp, label %end, label %then
78 store float 1.0, float* %A