brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · d08d455 Raw
61 lines · plain
1; RUN: opt -passes=always-inline -S < %s | FileCheck %s2 3; We used to misclassify inalloca as a static alloca in the inliner. This only4; arose with for alwaysinline functions, because the normal inliner refuses to5; inline such things.6 7; Generated using this C++ source:8; struct Foo {9;   Foo();10;   Foo(const Foo &o);11;   ~Foo();12;   int a;13; };14; __forceinline void h(Foo o) {}15; __forceinline void g() { h(Foo()); }16; void f() { g(); }17 18; ModuleID = 't.cpp'19source_filename = "t.cpp"20target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"21target triple = "i386-pc-windows-msvc19.0.24210"22 23%struct.Foo = type { i32 }24 25declare ptr @llvm.stacksave()26declare void @llvm.stackrestore(ptr)27 28declare x86_thiscallcc ptr @"\01??0Foo@@QAE@XZ"(ptr returned) unnamed_addr29declare x86_thiscallcc void @"\01??1Foo@@QAE@XZ"(ptr) unnamed_addr30 31define void @f() {32entry:33  call void @g()34  ret void35}36 37define internal void @g() alwaysinline {38entry:39  %inalloca.save = call ptr @llvm.stacksave()40  %argmem = alloca inalloca <{ %struct.Foo }>, align 441  %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)44  ret void45}46 47; Function Attrs: alwaysinline inlinehint nounwind48define internal void @h(ptr inalloca(<{ %struct.Foo }>)) alwaysinline {49entry:50  call x86_thiscallcc void @"\01??1Foo@@QAE@XZ"(ptr %0)51  ret void52}53 54; CHECK: define void @f()55; CHECK:   %[[STACKSAVE:.*]] = call ptr @llvm.stacksave.p0()56; CHECK:   %[[ARGMEM:.*]] = alloca inalloca <{ %struct.Foo }>, align 457; 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]])60; CHECK:   ret void61