1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2;
3;    void f(char *A, short N) {
4;      for (short i = 0; i < N; i++)
5;        A[(char)(N)]++;
6;    }
7;
8; FIXME: We should the truncate precisely... or just make it a separate parameter.
9; CHECK:       Assumed Context:
10; CHECK-NEXT:  [N] -> {  :  }
11; CHECK-NEXT:  Invalid Context:
12; CHECK-NEXT:  [N] -> { : N >= 128 }
13;
14; CHECK:         ReadAccess :=	[Reduction Type: +] [Scalar: 0]
15; CHECK-NEXT:        [N] -> { Stmt_for_body[i0] -> MemRef_A[N] };
16; CHECK-NEXT:    MustWriteAccess :=	[Reduction Type: +] [Scalar: 0]
17; CHECK-NEXT:        [N] -> { Stmt_for_body[i0] -> MemRef_A[N] };
18;
19target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
20
21define void @f(i8* %A, i16 signext %N) {
22entry:
23  br label %for.cond
24
25for.cond:                                         ; preds = %for.inc, %entry
26  %indvars.iv = phi i16 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
27  %cmp = icmp slt i16 %indvars.iv, %N
28  br i1 %cmp, label %for.body, label %for.end
29
30for.body:                                         ; preds = %for.cond
31  %idxprom = trunc i16 %N to i8
32  %arrayidx = getelementptr inbounds i8, i8* %A, i8 %idxprom
33  %tmp1 = load i8, i8* %arrayidx, align 1
34  %inc = add i8 %tmp1, 1
35  store i8 %inc, i8* %arrayidx, align 1
36  br label %for.inc
37
38for.inc:                                          ; preds = %for.body
39  %indvars.iv.next = add nuw nsw i16 %indvars.iv, 1
40  br label %for.cond
41
42for.end:                                          ; preds = %for.cond
43  ret void
44}
45