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

Unified Diff: tests_lit/llvm2ice_tests/ebp_args.ll

Issue 331743002: Ignore stack adjustment for ebp-based variables (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 6 months 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/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/ebp_args.ll
diff --git a/tests_lit/llvm2ice_tests/ebp_args.ll b/tests_lit/llvm2ice_tests/ebp_args.ll
new file mode 100644
index 0000000000000000000000000000000000000000..e7acd5098862fe7d7078068fed0c27d519acb81e
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/ebp_args.ll
@@ -0,0 +1,39 @@
+; This test originally exhibited a bug in ebp-based stack slots. The
+; problem was that during a function call push sequence, the esp
+; adjustment was incorrectly added to the stack/frame offset for
+; ebp-based frames.
+
+; RUN: %llvm2ice -Om1 --target=x8632 --verbose none %s | FileCheck %s
+
+declare i32 @memcpy_helper2(i32 %buf, i32 %buf2, i32 %n);
+
+define i32 @memcpy_helper(i32 %buf, i32 %n) {
+entry:
+ %n.arg_trunc = trunc i32 %n to i8
+ %buf2 = alloca i8, i32 128, align 4
+ %buf2.asint = ptrtoint i8* %buf2 to i32
+ %arg_ext = zext i8 %n.arg_trunc to i32
+ %call = call i32 @memcpy_helper2(i32 %buf, i32 %buf2.asint, i32 %arg_ext)
+ ret i32 %call
+}
+
+; This check sequence is highly specific to the current Om1 lowering
+; and stack slot assignment code, and may need to be relaxed if the
+; lowering code changes.
+
+; CHECK: memcpy_helper:
+; CHECK: push ebp
+; CHECK: mov ebp, esp
+; CHECK: sub esp, 20
+; CHECK: mov eax, dword ptr [ebp+12]
+; CHECK: mov dword ptr [ebp-4], eax
+; CHECK: sub esp, 128
+; CHECK: mov dword ptr [ebp-8], esp
+; CHECK: mov eax, dword ptr [ebp-8]
+; CHECK: mov dword ptr [ebp-12], eax
+; CHECK: movzx eax, byte ptr [ebp-4]
+; CHECK: mov dword ptr [ebp-16], eax
+; CHECK: push dword ptr [ebp-16]
+; CHECK: push dword ptr [ebp-12]
+; CHECK: push dword ptr [ebp+8]
+; CHECK: call memcpy_helper2
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698