74 lines · plain
1; RUN: opt %loadNPMPolly -polly-detect-full-functions -polly-invariant-load-hoisting '-passes=cgscc(polly-inline),polly-custom<print-scops>' -disable-output < %s 2>&1 | FileCheck %s2 3; Check that we inline a function that requires invariant load hoisting4; correctly.5; CHECK: Max Loop Depth: 26 7 8; void to_be_inlined(int A[], int *begin, int *end) {9; for(int i = *begin; i < *end; i++) {10; A[i] = 10;11; }12; }13;14; static const int N = 1000;15;16; void inline_site(int A[], int *begin, int *end) {17; for(int i = 0; i < N; i++)18; to_be_inlined(A);19; }20 21target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"22target triple = "x86_64-apple-macosx10.12.0"23 24define void @to_be_inlined(ptr %A, ptr %begin, ptr %end) {25entry:26 br label %entry.split27 28entry.split: ; preds = %entry29 %tmp = load i32, ptr %begin, align 430 %tmp21 = load i32, ptr %end, align 431 %cmp3 = icmp slt i32 %tmp, %tmp2132 br i1 %cmp3, label %for.body.lr.ph, label %for.end33 34for.body.lr.ph: ; preds = %entry.split35 %tmp1 = sext i32 %tmp to i6436 br label %for.body37 38for.body: ; preds = %for.body.lr.ph, %for.body39 %indvars.iv4 = phi i64 [ %tmp1, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]40 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv441 store i32 10, ptr %arrayidx, align 442 %indvars.iv.next = add i64 %indvars.iv4, 143 %tmp2 = load i32, ptr %end, align 444 %tmp3 = sext i32 %tmp2 to i6445 %cmp = icmp slt i64 %indvars.iv.next, %tmp346 br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge47 48for.cond.for.end_crit_edge: ; preds = %for.body49 br label %for.end50 51for.end: ; preds = %for.cond.for.end_crit_edge, %entry.split52 ret void53}54 55 56define void @inline_site(ptr %A, ptr %begin, ptr %end) {57entry:58 br label %entry.split59 60entry.split: ; preds = %entry61 br label %for.body62 63for.body: ; preds = %entry.split, %for.body64 %i.01 = phi i32 [ 0, %entry.split ], [ %inc, %for.body ]65 tail call void @to_be_inlined(ptr %A, ptr %begin, ptr %end)66 %inc = add nuw nsw i32 %i.01, 167 %exitcond = icmp eq i32 %inc, 100068 br i1 %exitcond, label %for.end, label %for.body69 70for.end: ; preds = %for.body71 ret void72}73 74