1 ; Test that functions with dynamic allocas get inlined in a case where
2 ; naively inlining it would result in a miscompilation.
3 ; Functions with dynamic allocas can only be inlined into functions that
4 ; already have dynamic allocas.
6 ; RUN: opt < %s -passes=inline -S | FileCheck %s
8 ; FIXME: This test is xfailed because the inline cost rewrite disabled *all*
9 ; inlining of functions which contain a dynamic alloca. It should be re-enabled
10 ; once that functionality is restored.
13 declare void @ext(ptr)
15 define internal void @callee(i32 %N) {
16 %P = alloca i32, i32 %N
17 call void @ext(ptr %P)
21 define void @foo(i32 %N) {
23 ; CHECK: alloca i32, i32 %{{.*}}
24 ; CHECK: call ptr @llvm.stacksave()
25 ; CHECK: alloca i32, i32 %{{.*}}
26 ; CHECK: call void @ext
27 ; CHECK: call void @llvm.stackrestore
31 %P = alloca i32, i32 %N
32 call void @ext(ptr %P)
36 %count = phi i32 [ 0, %entry ], [ %next, %loop ]
37 %next = add i32 %count, 1
38 call void @callee(i32 %N)
39 %cond = icmp eq i32 %count, 100000
40 br i1 %cond, label %out, label %loop