1; RUN: llc < %s -mtriple=i686-pc-win32 | FileCheck %s
2
3%Iter = type { i32, i32, i32 }
4
5%frame.reverse = type { %Iter, %Iter }
6
7declare void @llvm.stackrestore(i8*)
8declare i8* @llvm.stacksave()
9declare void @begin(%Iter* sret)
10declare void @plus(%Iter* sret, %Iter*, i32)
11declare void @reverse(%frame.reverse* inalloca align 4)
12
13define i32 @main() {
14  %temp.lvalue = alloca %Iter
15  br label %blah
16
17blah:
18  %inalloca.save = call i8* @llvm.stacksave()
19  %rev_args = alloca inalloca %frame.reverse, align 4
20  %beg = getelementptr %frame.reverse, %frame.reverse* %rev_args, i32 0, i32 0
21  %end = getelementptr %frame.reverse, %frame.reverse* %rev_args, i32 0, i32 1
22
23; CHECK:  calll   __chkstk
24; CHECK:  movl    %[[beg:[^,]*]], %esp
25; CHECK:  leal    12(%[[beg]]), %[[end:[^ ]*]]
26
27  call void @begin(%Iter* sret %temp.lvalue)
28; CHECK:  calll _begin
29
30  invoke void @plus(%Iter* sret %end, %Iter* %temp.lvalue, i32 4)
31          to label %invoke.cont unwind label %lpad
32
33;  Uses end as sret param.
34; CHECK:  pushl %[[end]]
35; CHECK:  calll _plus
36
37invoke.cont:
38  call void @begin(%Iter* sret %beg)
39
40; CHECK:  pushl %[[beg]]
41; CHECK:  calll _begin
42
43  invoke void @reverse(%frame.reverse* inalloca align 4 %rev_args)
44          to label %invoke.cont5 unwind label %lpad
45
46invoke.cont5:                                     ; preds = %invoke.cont
47  call void @llvm.stackrestore(i8* %inalloca.save)
48  ret i32 0
49
50lpad:                                             ; preds = %invoke.cont, %entry
51  %lp = landingpad { i8*, i32 } personality i8* null
52          cleanup
53  unreachable
54}
55