1; This test originally exhibited a bug in ebp-based stack slots. The 2; problem was that during a function call push sequence, the esp 3; adjustment was incorrectly added to the stack/frame offset for 4; ebp-based frames. 5 6; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 \ 7; RUN: -allow-externally-defined-symbols | FileCheck %s 8 9declare i32 @memcpy_helper2(i32 %buf, i32 %buf2, i32 %n) 10 11define internal i32 @memcpy_helper(i32 %buf, i32 %n) { 12entry: 13 br label %eblock ; Disable alloca optimization 14eblock: 15 %buf2 = alloca i8, i32 128, align 4 16 %n.arg_trunc = trunc i32 %n to i8 17 %arg.ext = zext i8 %n.arg_trunc to i32 18 %buf2.asint = ptrtoint i8* %buf2 to i32 19 %call = call i32 @memcpy_helper2(i32 %buf, i32 %buf2.asint, i32 %arg.ext) 20 ret i32 %call 21} 22 23; This check sequence is highly specific to the current Om1 lowering 24; and stack slot assignment code, and may need to be relaxed if the 25; lowering code changes. 26 27; CHECK-LABEL: memcpy_helper 28; CHECK: push ebp 29; CHECK: mov ebp,esp 30; CHECK: sub esp,0x28 31; CHECK: sub esp,0x80 32; CHECK: lea eax,[esp+0x10] 33; CHECK: mov DWORD PTR [ebp-0x4],eax 34; CHECK: mov eax,DWORD PTR [ebp+0xc] 35; CHECK: mov BYTE PTR [ebp-0x8],al 36; CHECK: movzx eax,BYTE PTR [ebp-0x8] 37; CHECK: mov DWORD PTR [ebp-0xc],eax 38; CHECK: mov eax,DWORD PTR [ebp+0x8] 39; CHECK: mov DWORD PTR [esp],eax 40; CHECK: mov eax,DWORD PTR [ebp-0x4] 41; CHECK: mov DWORD PTR [esp+0x4],eax 42; CHECK: mov eax,DWORD PTR [ebp-0xc] 43; CHECK: mov DWORD PTR [esp+0x8],eax 44; CHECK: call {{.*}} R_{{.*}} memcpy_helper2 45