1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2;
3;    void f(char *A, short N) {
4;      for (char i = 0; i < (char)N; i++)
5;        A[i]++;
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 <= -129 or N >= 128 }
13;
14; CHECK:       Domain :=
15; CHECK-NEXT:    [N] -> { Stmt_for_body[i0] : 0 <= i0 < N };
16;
17target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
18
19define void @f(i8* %A, i16 signext %N) {
20entry:
21  br label %for.cond
22
23for.cond:                                         ; preds = %for.inc, %entry
24  %i.0 = phi i8 [ 0, %entry ], [ %inc4, %for.inc ]
25  %conv = sext i8 %i.0 to i32
26  %conv1 = zext i16 %N to i32
27  %sext = shl i32 %conv1, 24
28  %conv2 = ashr exact i32 %sext, 24
29  %cmp = icmp slt i32 %conv, %conv2
30  br i1 %cmp, label %for.body, label %for.end
31
32for.body:                                         ; preds = %for.cond
33  %idxprom = sext i8 %i.0 to i64
34  %arrayidx = getelementptr inbounds i8, i8* %A, i64 %idxprom
35  %tmp = load i8, i8* %arrayidx, align 1
36  %inc = add i8 %tmp, 1
37  store i8 %inc, i8* %arrayidx, align 1
38  br label %for.inc
39
40for.inc:                                          ; preds = %for.body
41  %inc4 = add nsw i8 %i.0, 1
42  br label %for.cond
43
44for.end:                                          ; preds = %for.cond
45  ret void
46}
47