[Polly][NewPM] Reenable ScopPassManager unittest
[polly-mirror.git] / test / ScopDetect / non-beneficial-loops-small-trip-count.ll
blob3911b66ad32c787d1fd1c62f8e065e8b3516fb85
1 ; RUN: opt %loadPolly -polly-process-unprofitable=false -polly-detect \
2 ; RUN:   -analyze < %s | FileCheck %s
4 ; CHECK-NOT: Valid
6 ; Do not consider this a SCoP as we do not perform any optimizations for
7 ; loops with a small trip count.
9 ;    void f(int *A) {
10 ;      for (int i = 0; i < 4; i++)
11 ;        for (int j = 0; j < 4; j++)
12 ;          for (int k = 0; k < 4; k++)
13 ;            for (int l = 0; l < 4; l++)
14 ;              A[i] += A[i] * A[i - 1] + A[i + 1];
15 ;    }
17 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
19 define void @f(i32* %A) {
20 entry:
21   br label %for.cond
23 for.cond:                                         ; preds = %for.inc.24, %entry
24   %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc.24 ], [ 0, %entry ]
25   %exitcond5 = icmp ne i64 %indvars.iv, 4
26   br i1 %exitcond5, label %for.body, label %for.end.26
28 for.body:                                         ; preds = %for.cond
29   br label %for.cond.1
31 for.cond.1:                                       ; preds = %for.inc.21, %for.body
32   %j.0 = phi i32 [ 0, %for.body ], [ %inc22, %for.inc.21 ]
33   %exitcond2 = icmp ne i32 %j.0, 4
34   br i1 %exitcond2, label %for.body.3, label %for.end.23
36 for.body.3:                                       ; preds = %for.cond.1
37   br label %for.cond.4
39 for.cond.4:                                       ; preds = %for.inc.18, %for.body.3
40   %k.0 = phi i32 [ 0, %for.body.3 ], [ %inc19, %for.inc.18 ]
41   %exitcond1 = icmp ne i32 %k.0, 4
42   br i1 %exitcond1, label %for.body.6, label %for.end.20
44 for.body.6:                                       ; preds = %for.cond.4
45   br label %for.cond.7
47 for.cond.7:                                       ; preds = %for.inc, %for.body.6
48   %l.0 = phi i32 [ 0, %for.body.6 ], [ %inc, %for.inc ]
49   %exitcond = icmp ne i32 %l.0, 4
50   br i1 %exitcond, label %for.body.9, label %for.end
52 for.body.9:                                       ; preds = %for.cond.7
53   %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
54   %tmp = load i32, i32* %arrayidx, align 4
55   %tmp6 = add nsw i64 %indvars.iv, -1
56   %arrayidx11 = getelementptr inbounds i32, i32* %A, i64 %tmp6
57   %tmp7 = load i32, i32* %arrayidx11, align 4
58   %mul = mul nsw i32 %tmp, %tmp7
59   %tmp8 = add nuw nsw i64 %indvars.iv, 1
60   %arrayidx13 = getelementptr inbounds i32, i32* %A, i64 %tmp8
61   %tmp9 = load i32, i32* %arrayidx13, align 4
62   %add14 = add nsw i32 %mul, %tmp9
63   %arrayidx16 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
64   %tmp10 = load i32, i32* %arrayidx16, align 4
65   %add17 = add nsw i32 %tmp10, %add14
66   store i32 %add17, i32* %arrayidx16, align 4
67   br label %for.inc
69 for.inc:                                          ; preds = %for.body.9
70   %inc = add nuw nsw i32 %l.0, 1
71   br label %for.cond.7
73 for.end:                                          ; preds = %for.cond.7
74   br label %for.inc.18
76 for.inc.18:                                       ; preds = %for.end
77   %inc19 = add nuw nsw i32 %k.0, 1
78   br label %for.cond.4
80 for.end.20:                                       ; preds = %for.cond.4
81   br label %for.inc.21
83 for.inc.21:                                       ; preds = %for.end.20
84   %inc22 = add nuw nsw i32 %j.0, 1
85   br label %for.cond.1
87 for.end.23:                                       ; preds = %for.cond.1
88   br label %for.inc.24
90 for.inc.24:                                       ; preds = %for.end.23
91   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
92   br label %for.cond
94 for.end.26:                                       ; preds = %for.cond
95   ret void