58 lines · plain
1; RUN: llc < %s | FileCheck %s2 3; Make sure we check that forwarded memory arguments are not modified when tail4; 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(ptr)11 12define x86_thiscallcc void @preallocated(ptr %this, ptr preallocated(i32) %args) {13entry:14 %val = load i32, ptr %args15 store i32 0, ptr %args16 tail call x86_stdcallcc void @tail_std(i32 %val)17 ret void18}19 20; CHECK-LABEL: _preallocated: # @preallocated21; CHECK: movl 4(%esp), %[[reg:[^ ]*]]22; CHECK: movl $0, 4(%esp)23; CHECK: pushl %[[reg]]24; CHECK: calll _tail_std@425; CHECK: retl $426 27define x86_thiscallcc void @inalloca(ptr %this, ptr inalloca(i32) %args) {28entry:29 %val = load i32, ptr %args30 store i32 0, ptr %args31 tail call x86_stdcallcc void @tail_std(i32 %val)32 ret void33}34 35; CHECK-LABEL: _inalloca: # @inalloca36; CHECK: movl 4(%esp), %[[reg:[^ ]*]]37; CHECK: movl $0, 4(%esp)38; CHECK: pushl %[[reg]]39; CHECK: calll _tail_std@440; CHECK: retl $441 42define x86_stdcallcc void @copy_elide(i32 %arg) {43entry:44 %arg.ptr = alloca i3245 store i32 %arg, ptr %arg.ptr46 call void @capture(ptr %arg.ptr)47 tail call x86_stdcallcc void @tail_std(i32 %arg)48 ret void49}50 51; CHECK-LABEL: _copy_elide@4: # @copy_elide52; CHECK: leal {{[0-9]+}}(%esp), %[[reg:[^ ]*]]53; CHECK: pushl %[[reg]]54; CHECK: calll _capture55; ...56; CHECK: calll _tail_std@457; CHECK: retl $458