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 -inline -S | \
7 ; RUN: grep llvm.stacksave
8 ; RUN: opt < %s -inline -S | not grep callee
11 declare void @ext(i32*)
13 define internal void @callee(i32 %N) {
14 %P = alloca i32, i32 %N ; <i32*> [#uses=1]
15 call void @ext( i32* %P )
19 define void @foo(i32 %N) {
21 %P = alloca i32, i32 %N ; <i32*> [#uses=1]
22 call void @ext( i32* %P )
25 Loop: ; preds = %Loop, %0
26 %count = phi i32 [ 0, %0 ], [ %next, %Loop ] ; <i32> [#uses=2]
27 %next = add i32 %count, 1 ; <i32> [#uses=1]
28 call void @callee( i32 %N )
29 %cond = icmp eq i32 %count, 100000 ; <i1> [#uses=1]
30 br i1 %cond, label %out, label %Loop