OLD | NEW |
1 ; This test originally exhibited a bug in ebp-based stack slots. The | 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 | 2 ; problem was that during a function call push sequence, the esp |
3 ; adjustment was incorrectly added to the stack/frame offset for | 3 ; adjustment was incorrectly added to the stack/frame offset for |
4 ; ebp-based frames. | 4 ; ebp-based frames. |
5 | 5 |
6 ; RUN: %p2i -i %s --args -Om1 --target=x8632 --verbose none \ | 6 ; RUN: %p2i --assemble --disassemble -i %s --args -Om1 --target=x8632 \ |
7 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 7 ; RUN: --verbose none | FileCheck %s |
8 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s | |
9 | 8 |
10 declare i32 @memcpy_helper2(i32 %buf, i32 %buf2, i32 %n) | 9 declare i32 @memcpy_helper2(i32 %buf, i32 %buf2, i32 %n) |
11 | 10 |
12 define i32 @memcpy_helper(i32 %buf, i32 %n) { | 11 define i32 @memcpy_helper(i32 %buf, i32 %n) { |
13 entry: | 12 entry: |
14 %buf2 = alloca i8, i32 128, align 4 | 13 %buf2 = alloca i8, i32 128, align 4 |
15 %n.arg_trunc = trunc i32 %n to i8 | 14 %n.arg_trunc = trunc i32 %n to i8 |
16 %arg_ext = zext i8 %n.arg_trunc to i32 | 15 %arg.ext = zext i8 %n.arg_trunc to i32 |
17 %buf2.asint = ptrtoint i8* %buf2 to i32 | 16 %buf2.asint = ptrtoint i8* %buf2 to i32 |
18 %call = call i32 @memcpy_helper2(i32 %buf, i32 %buf2.asint, i32 %arg_ext) | 17 %call = call i32 @memcpy_helper2(i32 %buf, i32 %buf2.asint, i32 %arg.ext) |
19 ret i32 %call | 18 ret i32 %call |
20 } | 19 } |
21 | 20 |
22 ; This check sequence is highly specific to the current Om1 lowering | 21 ; This check sequence is highly specific to the current Om1 lowering |
23 ; and stack slot assignment code, and may need to be relaxed if the | 22 ; and stack slot assignment code, and may need to be relaxed if the |
24 ; lowering code changes. | 23 ; lowering code changes. |
25 | 24 |
26 ; CHECK-LABEL: memcpy_helper: | 25 ; CHECK-LABEL: memcpy_helper |
27 ; CHECK: push ebp | 26 ; CHECK: push ebp |
28 ; CHECK: mov ebp, esp | 27 ; CHECK: mov ebp,esp |
29 ; CHECK: sub esp, 24 | 28 ; CHECK: sub esp, 24 |
30 ; CHECK: sub esp, 128 | 29 ; CHECK: sub esp, 128 |
31 ; CHECK: mov dword ptr [ebp - 4], esp | 30 ; CHECK: mov DWORD PTR [ebp-4],esp |
32 ; CHECK: mov eax, dword ptr [ebp + 12] | 31 ; CHECK: mov eax,DWORD ptr [ebp+12] |
33 ; CHECK: mov dword ptr [ebp - 8], eax | 32 ; CHECK: mov DWORD PTR [ebp-8],eax |
34 ; CHECK: movzx eax, byte ptr [ebp - 8] | 33 ; CHECK: movzx eax,BYTE PTR [ebp-8] |
35 ; CHECK: mov dword ptr [ebp - 12], eax | 34 ; CHECK: mov DWORD PTR [ebp-12],eax |
36 ; CHECK: sub esp, 16 | 35 ; CHECK: sub esp, 16 |
37 ; CHECK: mov eax, dword ptr [ebp + 8] | 36 ; CHECK: mov eax,DWORD ptr [ebp+8] |
38 ; CHECK: mov dword ptr [esp], eax | 37 ; CHECK: mov DWORD PTR [esp],eax |
39 ; CHECK: mov eax, dword ptr [ebp - 4] | 38 ; CHECK: mov eax,DWORD ptr [ebp-4] |
40 ; CHECK: mov dword ptr [esp + 4], eax | 39 ; CHECK: mov DWORD PTR [esp+4],eax |
41 ; CHECK: mov eax, dword ptr [ebp - 12] | 40 ; CHECK: mov eax,DWORD ptr [ebp-12] |
42 ; CHECK: mov dword ptr [esp + 8], eax | 41 ; CHECK: mov DWORD PTR [esp+8],eax |
43 ; CHECK: call memcpy_helper2 | 42 ; CHECK: call |
| 43 ; CHECK-NEXT: R_{{.*}} memcpy_helper2 |
OLD | NEW |