1; RUN: llc < %s | FileCheck %s 2 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. 5 6target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 7target triple = "i386-pc-windows-msvc19.0.24215" 8 9declare x86_stdcallcc void @tail_std(i32) 10declare void @capture(i32*) 11 12define x86_thiscallcc void @preallocated(i32* %this, i32* preallocated(i32) %args) { 13entry: 14 %val = load i32, i32* %args 15 store i32 0, i32* %args 16 tail call x86_stdcallcc void @tail_std(i32 %val) 17 ret void 18} 19 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 25; CHECK: retl $4 26 27define x86_thiscallcc void @inalloca(i32* %this, i32* inalloca %args) { 28entry: 29 %val = load i32, i32* %args 30 store i32 0, i32* %args 31 tail call x86_stdcallcc void @tail_std(i32 %val) 32 ret void 33} 34 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 40; CHECK: retl $4 41 42define x86_stdcallcc void @copy_elide(i32 %arg) { 43entry: 44 %arg.ptr = alloca i32 45 store i32 %arg, i32* %arg.ptr 46 call void @capture(i32* %arg.ptr) 47 tail call x86_stdcallcc void @tail_std(i32 %arg) 48 ret void 49} 50 51; CHECK-LABEL: _copy_elide@4: # @copy_elide 52; CHECK: leal {{[0-9]+}}(%esp), %[[reg:[^ ]*]] 53; CHECK: pushl %[[reg]] 54; CHECK: calll _capture 55; ... 56; CHECK: calll _tail_std@4 57; CHECK: retl $4 58