Remove irrelevant references to legacy git repositories from
[polly-mirror.git] / test / ScopDetect / index_from_unpredictable_loop.ll
blobb487d0df61e9b2e3923ecd201b584c6576c77903
1 ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s --check-prefix=AFFINE
2 ; RUN: opt %loadPolly -polly-scops -polly-allow-nonaffine -analyze < %s | FileCheck %s --check-prefix=NONAFFINE
4 ; The SCoP contains a loop with multiple exit blocks (BBs after leaving
5 ; the loop). The current implementation of deriving their domain derives
6 ; only a common domain for all of the exit blocks. We disabled loops with
7 ; multiple exit blocks until this is fixed.
8 ; XFAIL: *
10 ; The loop for.body => for.inc has an unpredictable iteration count could due to
11 ; the undef start value that it is compared to. Therefore the array element
12 ; %arrayidx101 that depends on that exit value cannot be affine.
13 ; Derived from test-suite/MultiSource/Benchmarks/BitBench/uuencode/uuencode.c
15 define void @encode_line(i8* nocapture readonly %input, i32 %octets, i64 %p) {
16 entry:
17   br i1 undef, label %for.body, label %for.end
19 for.body:
20   %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %p, %entry ]
21   %octets.addr.02 = phi i32 [ undef, %for.inc ], [ %octets, %entry ]
22   br i1 false, label %for.inc, label %if.else
24 if.else:
25   %cond = icmp eq i32 %octets.addr.02, 2
26   br i1 %cond, label %if.then84, label %for.end
28 if.then84:
29   %0 = add nsw i64 %indvars.iv, 1
30   %arrayidx101 = getelementptr inbounds i8, i8* %input, i64 %0
31   store i8 42, i8* %arrayidx101, align 1
32   br label %for.end
34 for.inc:
35   %cmp = icmp sgt i32 %octets.addr.02, 3
36   %indvars.iv.next = add nsw i64 %indvars.iv, 3
37   br i1 %cmp, label %for.body, label %for.end
39 for.end:
40   ret void
43 ; AFFINE:       Region: %if.else---%for.end
45 ; AFFINE:       Statements {
46 ; AFFINE-NEXT:          Stmt_if_then84
47 ; AFFINE-NEXT:          Domain :=
48 ; AFFINE-NEXT:              [octets, p_1, p] -> { Stmt_if_then84[] : octets = 2 };
49 ; AFFINE-NEXT:          Schedule :=
50 ; AFFINE-NEXT:              [octets, p_1, p] -> { Stmt_if_then84[] -> [] };
51 ; AFFINE-NEXT:          MustWriteAccess :=      [Reduction Type: NONE] [Scalar: 0]
52 ; AFFINE-NEXT:              [octets, p_1, p] -> { Stmt_if_then84[] -> MemRef_input[1 + p] };
53 ; AFFINE-NEXT:  }
55 ; NONAFFINE:      Region: %for.body---%for.end
57 ; NONAFFINE:      Statements {
58 ; NONAFFINE-NEXT:       Stmt_for_body
59 ; NONAFFINE-NEXT:         Domain :=
60 ; NONAFFINE-NEXT:             [octets] -> { Stmt_for_body[0] };
61 ; NONAFFINE-NEXT:         Schedule :=
62 ; NONAFFINE-NEXT:             [octets] -> { Stmt_for_body[i0] -> [0, 0] };
63 ; NONAFFINE-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
64 ; NONAFFINE-NEXT:             [octets] -> { Stmt_for_body[i0] -> MemRef_indvars_iv[] };
65 ; NONAFFINE-NEXT:       Stmt_if_then84
66 ; NONAFFINE-NEXT:         Domain :=
67 ; NONAFFINE-NEXT:             [octets] -> { Stmt_if_then84[] : octets = 2 };
68 ; NONAFFINE-NEXT:         Schedule :=
69 ; NONAFFINE-NEXT:             [octets] -> { Stmt_if_then84[] -> [1, 0] };
70 ; NONAFFINE-NEXT:         ReadAccess := [Reduction Type: NONE] [Scalar: 1]
71 ; NONAFFINE-NEXT:             [octets] -> { Stmt_if_then84[] -> MemRef_indvars_iv[] };
72 ; NONAFFINE-NEXT:         MayWriteAccess :=     [Reduction Type: NONE] [Scalar: 0]
73 ; NONAFFINE-NEXT:             [octets] -> { Stmt_if_then84[] -> MemRef_input[o0] };
74 ; NONAFFINE-NEXT: }