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