| OLD | NEW |
| 1 ; RUIN: %llvm2ice --verbose none %s | FileCheck %s | 1 ; This is a basic test of the alloca instruction - one test for alloca |
| 2 ; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 2 ; of a fixed size, and one test for variable size. |
| 3 |
| 4 ; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
| 5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s |
| 6 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 3 ; RUN: %szdiff --llvm2ice=%llvm2ice %s | FileCheck --check-prefix=DUMP %s | 7 ; RUN: %szdiff --llvm2ice=%llvm2ice %s | FileCheck --check-prefix=DUMP %s |
| 4 | 8 |
| 5 define void @fixed_400(i32 %n) { | 9 define void @fixed_400(i32 %n) { |
| 6 entry: | 10 entry: |
| 7 %array = alloca i8, i32 400, align 16 | 11 %array = alloca i8, i32 400, align 16 |
| 8 %array.asint = ptrtoint i8* %array to i32 | 12 %array.asint = ptrtoint i8* %array to i32 |
| 9 call void @f1(i32 %array.asint) | 13 call void @f1(i32 %array.asint) |
| 10 ret void | 14 ret void |
| 11 ; CHECK: sub esp, 400 | |
| 12 ; CHECK-NEXT: mov eax, esp | |
| 13 ; CHECK-NEXT: push eax | |
| 14 ; CHECK-NEXT: call f1 | |
| 15 } | 15 } |
| 16 ; CHECK: fixed_400: |
| 17 ; CHECK: sub esp, 400 |
| 18 ; CHECK-NEXT: mov eax, esp |
| 19 ; CHECK-NEXT: push eax |
| 20 ; CHECK-NEXT: call f1 |
| 21 ; |
| 22 ; OPTM1: fixed_400: |
| 23 ; OPTM1: sub esp, 400 |
| 24 ; OPTM1-NEXT: mov {{.*}}, esp |
| 25 ; OPTM1: push |
| 26 ; OPTM1-NEXT: call f1 |
| 16 | 27 |
| 17 declare void @f1(i32) | 28 declare void @f1(i32) |
| 18 | 29 |
| 19 define void @variable_n(i32 %n) { | 30 define void @variable_n(i32 %n) { |
| 20 entry: | 31 entry: |
| 21 %array = alloca i8, i32 %n, align 16 | 32 %array = alloca i8, i32 %n, align 16 |
| 22 %array.asint = ptrtoint i8* %array to i32 | 33 %array.asint = ptrtoint i8* %array to i32 |
| 23 call void @f2(i32 %array.asint) | 34 call void @f2(i32 %array.asint) |
| 24 ret void | 35 ret void |
| 25 ; CHECK: mov eax, dword ptr [ebp+8] | |
| 26 ; CHECK-NEXT: sub esp, eax | |
| 27 ; CHECK-NEXT: mov eax, esp | |
| 28 ; CHECK-NEXT: push eax | |
| 29 ; CHECK-NEXT: call f2 | |
| 30 } | 36 } |
| 37 ; CHECK: variable_n: |
| 38 ; CHECK: mov eax, dword ptr [ebp+8] |
| 39 ; CHECK-NEXT: sub esp, eax |
| 40 ; CHECK-NEXT: mov eax, esp |
| 41 ; CHECK-NEXT: push eax |
| 42 ; CHECK-NEXT: call f2 |
| 43 ; |
| 44 ; OPTM1: variable_n: |
| 45 ; OPTM1: mov {{.*}}, esp |
| 46 ; OPTM1: push |
| 47 ; OPTM1-NEXT: call f2 |
| 31 | 48 |
| 32 declare void @f2(i32) | 49 declare void @f2(i32) |
| 33 | 50 |
| 34 ; ERRORS-NOT: ICE translation error | 51 ; ERRORS-NOT: ICE translation error |
| 35 ; DUMP-NOT: SZ | 52 ; DUMP-NOT: SZ |
| OLD | NEW |