Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: tests_lit/llvm2ice_tests/fused-alloca.ll

Issue 1435363002: Merge fixed alloca stack adjustments into the prolog (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Final code review comments Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests_lit/llvm2ice_tests/alloc.ll ('k') | tests_lit/llvm2ice_tests/fused-alloca-arg.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/fused-alloca.ll
diff --git a/tests_lit/llvm2ice_tests/fused-alloca.ll b/tests_lit/llvm2ice_tests/fused-alloca.ll
index bf80fcd6f838580cb7ab3818a31fc76e98d346bc..8daec9c3107238658d9210fe79c029c9fa09f3c4 100644
--- a/tests_lit/llvm2ice_tests/fused-alloca.ll
+++ b/tests_lit/llvm2ice_tests/fused-alloca.ll
@@ -19,14 +19,12 @@ entry:
ret void
}
; CHECK-LABEL: fused_small_align
-; CHECK-NEXT: sub esp,0xc
-; CHECK-NEXT: mov eax,DWORD PTR [esp+0x10]
; CHECK-NEXT: sub esp,0x30
-; CHECK-NEXT: mov {{.*}},esp
+; CHECK-NEXT: mov eax,DWORD PTR [esp+0x34]
; CHECK-NEXT: mov DWORD PTR [esp+0x10],eax
; CHECK-NEXT: mov DWORD PTR [esp+0x18],eax
; CHECK-NEXT: mov DWORD PTR [esp],eax
-; CHECK-NEXT: add esp,0x3c
+; CHECK-NEXT: add esp,0x30
; Test that a sequence of allocas with greater than stack alignment get fused.
define internal void @fused_large_align(i32 %arg) {
@@ -45,11 +43,9 @@ entry:
; CHECK-LABEL: fused_large_align
; CHECK-NEXT: push ebp
; CHECK-NEXT: mov ebp,esp
-; CHECK-NEXT: sub esp,0x8
-; CHECK-NEXT: mov eax,DWORD PTR [ebp+0x8]
-; CHECK-NEXT: and esp,0xffffffc0
; CHECK-NEXT: sub esp,0x80
-; CHECK-NEXT: mov ecx,esp
+; CHECK-NEXT: and esp,0xffffffc0
+; CHECK-NEXT: mov eax,DWORD PTR [ebp+0x8]
; CHECK-NEXT: mov DWORD PTR [esp+0x40],eax
; CHECK-NEXT: mov DWORD PTR [esp],eax
; CHECK-NEXT: mov DWORD PTR [esp+0x60],eax
@@ -80,13 +76,88 @@ block2:
br label %block1
}
; CHECK-LABEL: fused_derived
-; CHECK-NEXT: sub esp,0xc
-; CHECK-NEXT: mov [[ARG:e..]],DWORD PTR [esp+0x10]
; CHECK-NEXT: sub esp,0x180
-; CHECK-NEXT: mov {{.*}},esp
+; CHECK-NEXT: mov [[ARG:e..]],DWORD PTR [esp+0x184]
; CHECK-NEXT: jmp
; CHECK-NEXT: mov DWORD PTR [esp+0x80],[[ARG]]
; CHECK-NEXT: mov DWORD PTR [esp+0x8c],[[ARG]]
; CHECK-NEXT: lea eax,[esp+0x81]
-; CHECK-NEXT: add esp,0x18c
+; CHECK-NEXT: add esp,0x180
; CHECK-NEXT: ret
+
+; Test that a fixed alloca gets referenced by the frame pointer.
+define internal void @fused_small_align_with_dynamic(i32 %arg) {
+entry:
+ %a1 = alloca i8, i32 8, align 16
+ br label %next
+next:
+ %a2 = alloca i8, i32 12, align 1
+ %a3 = alloca i8, i32 16, align 1
+ %p1 = bitcast i8* %a1 to i32*
+ %p2 = bitcast i8* %a2 to i32*
+ %p3 = bitcast i8* %a3 to i32*
+ store i32 %arg, i32* %p1, align 1
+ store i32 %arg, i32* %p2, align 1
+ store i32 %arg, i32* %p3, align 1
+ ret void
+}
+; CHECK-LABEL: fused_small_align_with_dynamic
+; CHECK-NEXT: push ebp
+; CHECK-NEXT: mov ebp,esp
+; CHECK-NEXT: sub esp,0x18
+; CHECK-NEXT: mov eax,DWORD PTR [ebp+0x8]
+; CHECK-NEXT: sub esp,0x10
+; CHECK-NEXT: mov ecx,esp
+; CHECK-NEXT: sub esp,0x10
+; CHECK-NEXT: mov edx,esp
+; CHECK-NEXT: mov DWORD PTR [ebp-0x18],eax
+; CHECK-NEXT: mov DWORD PTR [ecx],eax
+; CHECK-NEXT: mov DWORD PTR [edx],eax
+; CHECK-NEXT: mov esp,ebp
+; CHECK-NEXT: pop ebp
+
+; Test that a sequence with greater than stack alignment and dynamic size
+; get folded and referenced correctly;
+
+define internal void @fused_large_align_with_dynamic(i32 %arg) {
+entry:
+ %a1 = alloca i8, i32 8, align 32
+ %a2 = alloca i8, i32 12, align 32
+ %a3 = alloca i8, i32 16, align 1
+ %a4 = alloca i8, i32 16, align 1
+ br label %next
+next:
+ %a5 = alloca i8, i32 16, align 1
+ %p1 = bitcast i8* %a1 to i32*
+ %p2 = bitcast i8* %a2 to i32*
+ %p3 = bitcast i8* %a3 to i32*
+ %p4 = bitcast i8* %a4 to i32*
+ %p5 = bitcast i8* %a5 to i32*
+ store i32 %arg, i32* %p1, align 1
+ store i32 %arg, i32* %p2, align 1
+ store i32 %arg, i32* %p3, align 1
+ store i32 %arg, i32* %p4, align 1
+ store i32 %arg, i32* %p5, align 1
+ ret void
+}
+; CHECK-LABEL: fused_large_align_with_dynamic
+; CHECK-NEXT: push ebx
+; CHECK-NEXT: push ebp
+; CHECK-NEXT: mov ebp,esp
+; CHECK-NEXT: sub esp,0x64
+; CHECK-NEXT: mov eax,DWORD PTR [ebp+0xc]
+; CHECK-NEXT: and esp,0xffffffe0
+; CHECK-NEXT: sub esp,0x40
+; CHECK-NEXT: mov ecx,esp
+; CHECK-NEXT: mov edx,ecx
+; CHECK-NEXT: add edx,0x20
+; CHECK-NEXT: add ecx,0x0
+; CHECK-NEXT: sub esp,0x10
+; CHECK-NEXT: mov ebx,esp
+; CHECK-NEXT: mov DWORD PTR [ecx],eax
+; CHECK-NEXT: mov DWORD PTR [edx],eax
+; CHECK-NEXT: mov DWORD PTR [ebp-0x14],eax
+; CHECK-NEXT: mov DWORD PTR [ebp-0x24],eax
+; CHECK-NEXT: mov DWORD PTR [ebx],eax
+; CHECK-NEXT: mov esp,ebp
+; CHECK-NEXT: pop ebp
« no previous file with comments | « tests_lit/llvm2ice_tests/alloc.ll ('k') | tests_lit/llvm2ice_tests/fused-alloca-arg.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698