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 @inalloca(i32* %this, i32* inalloca %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: _inalloca: # @inalloca 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_stdcallcc void @copy_elide(i32 %arg) { 28entry: 29 %arg.ptr = alloca i32 30 store i32 %arg, i32* %arg.ptr 31 call void @capture(i32* %arg.ptr) 32 tail call x86_stdcallcc void @tail_std(i32 %arg) 33 ret void 34} 35 36; CHECK-LABEL: _copy_elide@4: # @copy_elide 37; CHECK: leal {{[0-9]+}}(%esp), %[[reg:[^ ]*]] 38; CHECK: pushl %[[reg]] 39; CHECK: calll _capture 40; ... 41; CHECK: calll _tail_std@4 42; CHECK: retl $4 43