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 ; short index0 = (short)(i + N);
12 ; short index1 = (index0 * 1) + (short)M;
14 ; short index1 = (index0 * 16) + (short)M;
20 ; CHECK: Function: fast
21 ; CHECK: Function: slow
23 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25 define void @fast(ptr %A, i8 %N, i8 %M) {
29 for.cond: ; preds = %for.inc, %entry
30 %indvars.iv = phi i8 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
31 %exitcond = icmp ne i8 %indvars.iv, 8
32 br i1 %exitcond, label %for.body, label %for.end
34 for.body: ; preds = %for.cond
35 %tmp3 = add nsw i8 %indvars.iv, %N
36 %tmp3ext = sext i8 %tmp3 to i16
37 ;%mul = mul nsw i16 %tmp3ext, 16
38 %Mext = sext i8 %M to i16
39 %add2 = add nsw i16 %tmp3ext, %Mext
40 %arrayidx = getelementptr inbounds i8, ptr %A, i16 %add2
41 %tmp4 = load i8, ptr %arrayidx, align 4
42 %inc = add nsw i8 %tmp4, 1
43 store i8 %inc, ptr %arrayidx, align 4
46 for.inc: ; preds = %for.body
47 %indvars.iv.next = add nuw nsw i8 %indvars.iv, 1
50 for.end: ; preds = %for.cond
54 define void @slow(ptr %A, i8 %N, i8 %M) {
58 for.cond: ; preds = %for.inc, %entry
59 %indvars.iv = phi i8 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
60 %exitcond = icmp ne i8 %indvars.iv, 8
61 br i1 %exitcond, label %for.body, label %for.end
63 for.body: ; preds = %for.cond
64 %tmp3 = add nsw i8 %indvars.iv, %N
65 %tmp3ext = sext i8 %tmp3 to i16
66 %mul = mul nsw i16 %tmp3ext, 16
67 %Mext = sext i8 %M to i16
68 %add2 = add nsw i16 %mul, %Mext
69 %arrayidx = getelementptr inbounds i8, ptr %A, i16 %add2
70 %tmp4 = load i8, ptr %arrayidx, align 4
71 %inc = add nsw i8 %tmp4, 1
72 store i8 %inc, ptr %arrayidx, align 4
75 for.inc: ; preds = %for.body
76 %indvars.iv.next = add nuw nsw i8 %indvars.iv, 1
79 for.end: ; preds = %for.cond