[JSON][PM] Port json import/export over to new pm
[polly-mirror.git] / test / ScopInfo / wraping_signed_expr_slow_2.ll
blob033096e5b72d53346ea773e05d43a1ef166379c7
1 ; RUN: opt %loadPolly -polly-scops -analyze < %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
5 ; all in place.
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;
13 ;        A[(short)index2]++;
14 ;      }
15 ;    }
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);
22 ;        A[index2]++;
23 ;      }
24 ;    }
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(i8* %A, i8 %N, i8 %M) {
32 entry:
33   br label %for.cond
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, i8* %A, i16 %add2ext
46   %tmp4 = load i8, i8* %arrayidx, align 4
47   %inc = add nsw i8 %tmp4, 1
48   store i8 %inc, i8* %arrayidx, align 4
49   br label %for.inc
51 for.inc:                                          ; preds = %for.body
52   %indvars.iv.next = add nuw nsw i8 %indvars.iv, 1
53   br label %for.cond
55 for.end:                                          ; preds = %for.cond
56   ret void
59 define void @slow(i8* %A, i8 %N, i8 %M) {
60 entry:
61   br label %for.cond
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, i8* %A, i16 %add2
75   %tmp4 = load i8, i8* %arrayidx, align 4
76   %inc = add nsw i8 %tmp4, 1
77   store i8 %inc, i8* %arrayidx, align 4
78   br label %for.inc
80 for.inc:                                          ; preds = %for.body
81   %indvars.iv.next = add nuw nsw i8 %indvars.iv, 1
82   br label %for.cond
84 for.end:                                          ; preds = %for.cond
85   ret void