1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
3 ; This checks that the no-wraps checks will be computed fast as some example
4 ; already showed huge slowdowns even though the inbounds and nsw flags were
7 ; // Inspired by itrans8x8 in transform8x8.c from the ldecode benchmark.
8 ; void fast(char *A, char N, char M) {
9 ; for (char i = 0; i < 8; i++) {
10 ; char index0 = i + N;
11 ; char index1 = index0 * 16;
12 ; char index2 = index1 + M;
17 ; void slow(char *A, char N, char M) {
18 ; for (char i = 0; i < 8; i++) {
19 ; char index0 = i + N;
20 ; char index1 = index0 * 16;
21 ; short index2 = ((short)index1) + ((short)M);
26 ; CHECK: Function: fast
27 ; CHECK: Function: slow
29 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
31 define void @fast(ptr %A, i8 %N, i8 %M) {
35 for.cond: ; preds = %for.inc, %entry
36 %indvars.iv = phi i8 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
37 %exitcond = icmp ne i8 %indvars.iv, 8
38 br i1 %exitcond, label %for.body, label %for.end
40 for.body: ; preds = %for.cond
41 %tmp3 = add nsw i8 %indvars.iv, %N
42 %mul = mul nsw i8 %tmp3, 16
43 %add2 = add nsw i8 %mul, %M
44 %add2ext = sext i8 %add2 to i16
45 %arrayidx = getelementptr inbounds i8, ptr %A, i16 %add2ext
46 %tmp4 = load i8, ptr %arrayidx, align 4
47 %inc = add nsw i8 %tmp4, 1
48 store i8 %inc, ptr %arrayidx, align 4
51 for.inc: ; preds = %for.body
52 %indvars.iv.next = add nuw nsw i8 %indvars.iv, 1
55 for.end: ; preds = %for.cond
59 define void @slow(ptr %A, i8 %N, i8 %M) {
63 for.cond: ; preds = %for.inc, %entry
64 %indvars.iv = phi i8 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
65 %exitcond = icmp ne i8 %indvars.iv, 8
66 br i1 %exitcond, label %for.body, label %for.end
68 for.body: ; preds = %for.cond
69 %tmp3 = add nsw i8 %indvars.iv, %N
70 %mul = mul nsw i8 %tmp3, 16
71 %mulext = sext i8 %mul to i16
72 %Mext = sext i8 %M to i16
73 %add2 = add nsw i16 %mulext, %Mext
74 %arrayidx = getelementptr inbounds i8, ptr %A, i16 %add2
75 %tmp4 = load i8, ptr %arrayidx, align 4
76 %inc = add nsw i8 %tmp4, 1
77 store i8 %inc, ptr %arrayidx, align 4
80 for.inc: ; preds = %for.body
81 %indvars.iv.next = add nuw nsw i8 %indvars.iv, 1
84 for.end: ; preds = %for.cond