Update Polly tests to handle explicitly typed gep changes in LLVM
[polly-mirror.git] / test / ScopInfo / max-loop-depth.ll
blob0c8e7284fa2c2a549d84d6cfe369485f5b2c2fa6
1 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-scops -analyze < %s | FileCheck %s
3 ;    void bar();
4 ;    void foo(int *A, int *B, long int N, long int M) {
5 ;      for (long int j = 0; j < M; ++j) {
6 ;        bar();
7 ;        for (long int i = 0; i < N; ++i)
8 ;          A[i] += 1;
9 ;        for (long int i = 0; i < N; ++i)
10 ;          A[i] += 1;
11 ;      }
12 ;    }
14 ; Test to check that the scop only counts loop depth for loops fully contained
15 ; in the scop.
16 ; CHECK: Max Loop Depth: 1
17 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
19 define void @foo(i32* %A, i32* %B, i64 %N, i64 %M) {
20 entry:
21   br label %for.cond
23 for.cond:                                         ; preds = %for.inc13, %entry
24   %j.0 = phi i64 [ 0, %entry ], [ %inc14, %for.inc13 ]
25   %cmp = icmp slt i64 %j.0, %M
26   br i1 %cmp, label %for.body, label %for.end15
28 for.body:                                         ; preds = %for.cond
29   call void (...)* @bar() #2
30   br label %for.cond1
32 for.cond1:                                        ; preds = %for.inc, %for.body
33   %i.0 = phi i64 [ 0, %for.body ], [ %inc, %for.inc ]
34   %cmp2 = icmp slt i64 %i.0, %N
35   br i1 %cmp2, label %for.body3, label %for.end
37 for.body3:                                        ; preds = %for.cond1
38   %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.0
39   %tmp = load i32* %arrayidx, align 4
40   %add = add nsw i32 %tmp, 1
41   store i32 %add, i32* %arrayidx, align 4
42   br label %for.inc
44 for.inc:                                          ; preds = %for.body3
45   %inc = add nuw nsw i64 %i.0, 1
46   br label %for.cond1
48 for.end:                                          ; preds = %for.cond1
49   br label %for.cond5
51 for.cond5:                                        ; preds = %for.inc10, %for.end
52   %i4.0 = phi i64 [ 0, %for.end ], [ %inc11, %for.inc10 ]
53   %cmp6 = icmp slt i64 %i4.0, %N
54   br i1 %cmp6, label %for.body7, label %for.end12
56 for.body7:                                        ; preds = %for.cond5
57   %arrayidx8 = getelementptr inbounds i32, i32* %A, i64 %i4.0
58   %tmp1 = load i32* %arrayidx8, align 4
59   %add9 = add nsw i32 %tmp1, 1
60   store i32 %add9, i32* %arrayidx8, align 4
61   br label %for.inc10
63 for.inc10:                                        ; preds = %for.body7
64   %inc11 = add nuw nsw i64 %i4.0, 1
65   br label %for.cond5
67 for.end12:                                        ; preds = %for.cond5
68   br label %for.inc13
70 for.inc13:                                        ; preds = %for.end12
71   %inc14 = add nuw nsw i64 %j.0, 1
72   br label %for.cond
74 for.end15:                                        ; preds = %for.cond
75   ret void
78 declare void @bar(...) #1