1 ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
4 ; void foo(int *A, int *B, long int N, long int M) {
5 ; for (long int j = 0; j < M; ++j) {
7 ; for (long int i = 0; i < N; ++i)
9 ; for (long int i = 0; i < N; ++i)
14 ; Test to check that the scop only counts loop depth for loops fully contained
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) {
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
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, i32* %arrayidx, align 4
40 %add = add nsw i32 %tmp, 1
41 store i32 %add, i32* %arrayidx, align 4
44 for.inc: ; preds = %for.body3
45 %inc = add nuw nsw i64 %i.0, 1
48 for.end: ; preds = %for.cond1
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, i32* %arrayidx8, align 4
59 %add9 = add nsw i32 %tmp1, 1
60 store i32 %add9, i32* %arrayidx8, align 4
63 for.inc10: ; preds = %for.body7
64 %inc11 = add nuw nsw i64 %i4.0, 1
67 for.end12: ; preds = %for.cond5
70 for.inc13: ; preds = %for.end12
71 %inc14 = add nuw nsw i64 %j.0, 1
74 for.end15: ; preds = %for.cond
78 declare void @bar(...) #1