1 ; RUN: opt -passes=always-inline -S < %s | FileCheck %s
3 ; We used to misclassify inalloca as a static alloca in the inliner. This only
4 ; arose with for alwaysinline functions, because the normal inliner refuses to
7 ; Generated using this C++ source:
14 ; __forceinline void h(Foo o) {}
15 ; __forceinline void g() { h(Foo()); }
19 source_filename = "t.cpp"
20 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
21 target triple = "i386-pc-windows-msvc19.0.24210"
23 %struct.Foo = type { i32 }
25 declare ptr @llvm.stacksave()
26 declare void @llvm.stackrestore(ptr)
28 declare x86_thiscallcc ptr @"\01??0Foo@@QAE@XZ"(ptr returned) unnamed_addr
29 declare x86_thiscallcc void @"\01??1Foo@@QAE@XZ"(ptr) unnamed_addr
37 define internal void @g() alwaysinline {
39 %inalloca.save = call ptr @llvm.stacksave()
40 %argmem = alloca inalloca <{ %struct.Foo }>, align 4
41 %call = call x86_thiscallcc ptr @"\01??0Foo@@QAE@XZ"(ptr %argmem)
42 call void @h(ptr inalloca(<{ %struct.Foo }>) %argmem)
43 call void @llvm.stackrestore(ptr %inalloca.save)
47 ; Function Attrs: alwaysinline inlinehint nounwind
48 define internal void @h(ptr inalloca(<{ %struct.Foo }>)) alwaysinline {
50 call x86_thiscallcc void @"\01??1Foo@@QAE@XZ"(ptr %0)
54 ; CHECK: define void @f()
55 ; CHECK: %[[STACKSAVE:.*]] = call ptr @llvm.stacksave.p0()
56 ; CHECK: %[[ARGMEM:.*]] = alloca inalloca <{ %struct.Foo }>, align 4
57 ; CHECK: %[[CALL:.*]] = call x86_thiscallcc ptr @"\01??0Foo@@QAE@XZ"(ptr %[[ARGMEM]])
58 ; CHECK: call x86_thiscallcc void @"\01??1Foo@@QAE@XZ"(ptr %[[ARGMEM]])
59 ; CHECK: call void @llvm.stackrestore.p0(ptr %[[STACKSAVE]])