Move two tests from SRETPromotion to Inline, since they only call opt -inline.
[oota-llvm.git] / test / Transforms / Inline / dynamic_alloca_test.ll
1 ; Test that functions with dynamic allocas get inlined in a case where
2 ; naively inlining it would result in a miscompilation.
3
4 ; RUN: llvm-as < %s | opt -inline | llvm-dis | \
5 ; RUN:   grep llvm.stacksave
6 ; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep callee
7
8
9 declare void @ext(i32*)
10
11 define internal void @callee(i32 %N) {
12         %P = alloca i32, i32 %N         ; <i32*> [#uses=1]
13         call void @ext( i32* %P )
14         ret void
15 }
16
17 define void @foo(i32 %N) {
18 ; <label>:0
19         br label %Loop
20
21 Loop:           ; preds = %Loop, %0
22         %count = phi i32 [ 0, %0 ], [ %next, %Loop ]            ; <i32> [#uses=2]
23         %next = add i32 %count, 1               ; <i32> [#uses=1]
24         call void @callee( i32 %N )
25         %cond = icmp eq i32 %count, 100000              ; <i1> [#uses=1]
26         br i1 %cond, label %out, label %Loop
27
28 out:            ; preds = %Loop
29         ret void
30 }
31