1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %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(ptr %A, ptr %B, i64 %N, i64 %M) {
21 %cmp1 = icmp slt i64 0, %M
22 br i1 %cmp1, label %for.body1, label %for.end1
24 for.body1: ; preds = %entry, %for.inc1
25 %j.0 = phi i64 [ 0, %entry ], [ %j.next, %for.inc1 ]
26 call void (...) @bar() #0
27 %cmp2 = icmp slt i64 0, %N
28 br i1 %cmp2, label %for.body2, label %for.end2
30 for.body2: ; preds = %for.body1, %for.inc2
31 %i.1 = phi i64 [ 0, %for.body1 ], [ %i.next.1, %for.inc2 ]
32 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %i.1
33 %tmp = load i32, ptr %arrayidx, align 4
34 %add = add nsw i32 %tmp, 1
35 store i32 %add, ptr %arrayidx, align 4
38 for.inc2: ; preds = %for.body2
39 %i.next.1 = add nuw nsw i64 %i.1, 1
40 %cmp3 = icmp slt i64 %i.next.1, %N
41 br i1 %cmp3, label %for.body2, label %for.end2
44 for.end2: ; preds = %for.inc2, %for.body1
45 %cmp4 = icmp slt i64 0, %N
46 br i1 %cmp4, label %for.body3, label %for.end3
48 for.body3: ; preds = %for.end2
49 %i.2 = phi i64 [ 0, %for.end2 ], [ %i.next.2, %for.inc3 ]
50 %arrayidx1 = getelementptr inbounds i32, ptr %A, i64 %i.2
51 %tmp1 = load i32, ptr %arrayidx1, align 4
52 %add1 = add nsw i32 %tmp1, 1
53 store i32 %add1, ptr %arrayidx1, align 4
56 for.inc3: ; preds = %for.body3
57 %i.next.2 = add nuw nsw i64 %i.2, 1
58 %cmp5 = icmp slt i64 %i.next.2, %N
59 br i1 %cmp5, label %for.body3, label %for.end3
61 for.end3: ; preds = %for.inc3, %for.end2
64 for.inc1: ; preds = %for.end3
65 %j.next = add nuw nsw i64 %j.0, 1
66 %cmp6 = icmp slt i64 %j.next, %M
67 br i1 %cmp6, label %for.body1, label %for.end1
69 for.end1: ; preds = %entry, %for.inc1
73 declare void @bar(...) #0