[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / polly / test / ScopInliner / invariant-load-func.ll
blob38e4a15aab9419b58a72204e1664abc4c5ff5c56
1 ; RUN: opt %loadPolly -polly-detect-full-functions -polly-scop-inliner \
2 ; RUN: -polly-invariant-load-hoisting -polly-print-scops -disable-output < %s | FileCheck %s
4 ; Check that we inline a function that requires invariant load hoisting
5 ; correctly.
6 ; CHECK:    Max Loop Depth:  2
8 ; REQUIRES: pollyacc
11 ; void to_be_inlined(int A[], int *begin, int *end) {
12 ;     for(int i = *begin; i < *end; i++) {
13 ;         A[i] = 10;
14 ;     }
15 ; }
17 ; static const int N = 1000;
19 ; void inline_site(int A[], int *begin, int *end) {
20 ;     for(int i = 0; i < N; i++)
21 ;         to_be_inlined(A);
22 ; }
24 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
25 target triple = "x86_64-apple-macosx10.12.0"
27 define void @to_be_inlined(ptr %A, ptr %begin, ptr %end) {
28 entry:
29   br label %entry.split
31 entry.split:                                      ; preds = %entry
32   %tmp = load i32, ptr %begin, align 4
33   %tmp21 = load i32, ptr %end, align 4
34   %cmp3 = icmp slt i32 %tmp, %tmp21
35   br i1 %cmp3, label %for.body.lr.ph, label %for.end
37 for.body.lr.ph:                                   ; preds = %entry.split
38   %tmp1 = sext i32 %tmp to i64
39   br label %for.body
41 for.body:                                         ; preds = %for.body.lr.ph, %for.body
42   %indvars.iv4 = phi i64 [ %tmp1, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
43   %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv4
44   store i32 10, ptr %arrayidx, align 4
45   %indvars.iv.next = add i64 %indvars.iv4, 1
46   %tmp2 = load i32, ptr %end, align 4
47   %tmp3 = sext i32 %tmp2 to i64
48   %cmp = icmp slt i64 %indvars.iv.next, %tmp3
49   br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
51 for.cond.for.end_crit_edge:                       ; preds = %for.body
52   br label %for.end
54 for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry.split
55   ret void
59 define void @inline_site(ptr %A, ptr %begin, ptr %end) {
60 entry:
61   br label %entry.split
63 entry.split:                                      ; preds = %entry
64   br label %for.body
66 for.body:                                         ; preds = %entry.split, %for.body
67   %i.01 = phi i32 [ 0, %entry.split ], [ %inc, %for.body ]
68   tail call void @to_be_inlined(ptr %A, ptr %begin, ptr %end)
69   %inc = add nuw nsw i32 %i.01, 1
70   %exitcond = icmp eq i32 %inc, 1000
71   br i1 %exitcond, label %for.end, label %for.body
73 for.end:                                          ; preds = %for.body
74   ret void