150
|
1 ; RUN: opt %loadPolly -polly-detect-full-functions -polly-scop-inliner \
|
|
2 ; RUN: -polly-scops -analyze < %s | FileCheck %s
|
|
3
|
|
4 ; Check that we get the 2 nested loops by inlining `to_be_inlined` into
|
|
5 ; `inline_site`.
|
|
6 ; CHECK: Max Loop Depth: 2
|
|
7
|
|
8 ; static const int N = 1000;
|
|
9 ;
|
|
10 ; void to_be_inlined(int A[]) {
|
|
11 ; for(int i = 0; i < N; i++)
|
|
12 ; A[i] *= 10;
|
|
13 ; }
|
|
14 ;
|
|
15 ; void inline_site(int A[]) {
|
|
16 ; for(int i = 0; i < N; i++)
|
|
17 ; to_be_inlined(A);
|
|
18 ; }
|
|
19
|
|
20 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
21 target triple = "x86_64-apple-macosx10.12.0"
|
|
22
|
|
23
|
|
24 define void @to_be_inlined(i32* %A) {
|
|
25 entry:
|
|
26 br label %entry.split
|
|
27
|
|
28 entry.split: ; preds = %entry
|
|
29 br label %for.body
|
|
30
|
|
31 for.body: ; preds = %entry.split, %for.body
|
|
32 %indvars.iv1 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next, %for.body ]
|
|
33 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv1
|
|
34 %tmp = load i32, i32* %arrayidx, align 4
|
|
35 %mul = mul nsw i32 %tmp, 10
|
|
36 store i32 %mul, i32* %arrayidx, align 4
|
|
37 %indvars.iv.next = add nuw nsw i64 %indvars.iv1, 1
|
|
38 %exitcond = icmp eq i64 %indvars.iv.next, 1000
|
|
39 br i1 %exitcond, label %for.end, label %for.body
|
|
40
|
|
41 for.end: ; preds = %for.body
|
|
42 ret void
|
|
43 }
|
|
44
|
|
45 define void @inline_site(i32* %A) {
|
|
46 entry:
|
|
47 br label %entry.split
|
|
48
|
|
49 entry.split: ; preds = %entry
|
|
50 br label %for.body
|
|
51
|
|
52 for.body: ; preds = %entry.split, %for.body
|
|
53 %i.01 = phi i32 [ 0, %entry.split ], [ %inc, %for.body ]
|
|
54 tail call void @to_be_inlined(i32* %A)
|
|
55 %inc = add nuw nsw i32 %i.01, 1
|
|
56 %exitcond = icmp eq i32 %inc, 1000
|
|
57 br i1 %exitcond, label %for.end, label %for.body
|
|
58
|
|
59 for.end: ; preds = %for.body
|
|
60 ret void
|
|
61 }
|
|
62
|