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

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

Issue 1411583007: Combine allocas (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Finish fast path. 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 | « src/IceTargetLoweringX86BaseImpl.h ('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
new file mode 100644
index 0000000000000000000000000000000000000000..eade86ba48aeef2b75ac3dfa0d386535df812c57
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/fused-alloca.ll
@@ -0,0 +1,57 @@
+; This is a basic test of the alloca instruction.
+
+; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
+; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \
+; RUN: | %if --need=target_X8632 --command FileCheck %s
+
+; Test that a sequence of allocas with less than stack alignment get fused.
+define internal void @fused_small_align(i32 %arg) {
+entry:
+ %a1 = alloca i8, i32 8, align 4
+ %a2 = alloca i8, i32 12, align 4
+ %a3 = alloca i8, i32 16, align 8
+ %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
+; 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 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
+
+; Test that a sequence of allocas with greater than stack alignment get fused.
+define internal void @fused_large_align(i32 %arg) {
+entry:
+ %a1 = alloca i8, i32 8, align 32
+ %a2 = alloca i8, i32 12, align 64
+ %a3 = alloca i8, i32 16, align 32
+ %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_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: mov DWORD PTR [esp+0x40],eax
+; CHECK-NEXT: mov DWORD PTR [esp],eax
+; CHECK-NEXT: mov DWORD PTR [esp+0x60],eax
+; CHECK-NEXT: mov esp,ebp
+; CHECK-NEXT: pop ebp
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | tests_lit/llvm2ice_tests/fused-alloca-arg.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698