1; RUN: opt %loadNPMPolly -polly-detect-full-functions -polly-scop-inliner \ 2; RUN: -polly-invariant-load-hoisting '-passes=print<polly-function-scops>' -disable-output < %s | FileCheck %s 3 4; Check that we inline a function that requires invariant load hoisting 5; correctly. 6; CHECK: Max Loop Depth: 2 7 8; REQUIRES: pollyacc 9 10 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; } 16; 17; static const int N = 1000; 18; 19; void inline_site(int A[], int *begin, int *end) { 20; for(int i = 0; i < N; i++) 21; to_be_inlined(A); 22; } 23 24target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 25target triple = "x86_64-apple-macosx10.12.0" 26 27define void @to_be_inlined(ptr %A, ptr %begin, ptr %end) { 28entry: 29 br label %entry.split 30 31entry.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 36 37for.body.lr.ph: ; preds = %entry.split 38 %tmp1 = sext i32 %tmp to i64 39 br label %for.body 40 41for.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 50 51for.cond.for.end_crit_edge: ; preds = %for.body 52 br label %for.end 53 54for.end: ; preds = %for.cond.for.end_crit_edge, %entry.split 55 ret void 56} 57 58 59define void @inline_site(ptr %A, ptr %begin, ptr %end) { 60entry: 61 br label %entry.split 62 63entry.split: ; preds = %entry 64 br label %for.body 65 66for.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 72 73for.end: ; preds = %for.body 74 ret void 75} 76 77