1 ; RUN: llc < %s | FileCheck %s
3 ; Make sure we check that forwarded memory arguments are not modified when tail
4 ; calling. inalloca and copy arg elimination make argument slots mutable.
6 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
7 target triple = "i386-pc-windows-msvc19.0.24215"
9 declare x86_stdcallcc void @tail_std(i32)
10 declare void @capture(ptr)
12 define x86_thiscallcc void @preallocated(ptr %this, ptr preallocated(i32) %args) {
14 %val = load i32, ptr %args
15 store i32 0, ptr %args
16 tail call x86_stdcallcc void @tail_std(i32 %val)
20 ; CHECK-LABEL: _preallocated: # @preallocated
21 ; CHECK: movl 4(%esp), %[[reg:[^ ]*]]
22 ; CHECK: movl $0, 4(%esp)
23 ; CHECK: pushl %[[reg]]
24 ; CHECK: calll _tail_std@4
27 define x86_thiscallcc void @inalloca(ptr %this, ptr inalloca(i32) %args) {
29 %val = load i32, ptr %args
30 store i32 0, ptr %args
31 tail call x86_stdcallcc void @tail_std(i32 %val)
35 ; CHECK-LABEL: _inalloca: # @inalloca
36 ; CHECK: movl 4(%esp), %[[reg:[^ ]*]]
37 ; CHECK: movl $0, 4(%esp)
38 ; CHECK: pushl %[[reg]]
39 ; CHECK: calll _tail_std@4
42 define x86_stdcallcc void @copy_elide(i32 %arg) {
45 store i32 %arg, ptr %arg.ptr
46 call void @capture(ptr %arg.ptr)
47 tail call x86_stdcallcc void @tail_std(i32 %arg)
51 ; CHECK-LABEL: _copy_elide@4: # @copy_elide
52 ; CHECK: leal {{[0-9]+}}(%esp), %[[reg:[^ ]*]]
53 ; CHECK: pushl %[[reg]]
54 ; CHECK: calll _capture
56 ; CHECK: calll _tail_std@4