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

Unified Diff: tests_lit/llvm2ice_tests/returns_twice_no_coalesce.ll

Issue 567553003: Mark setjmp as "returns twice" and turn off SimpleCoalescing when called. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: line up slash again Created 6 years, 3 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/returns_twice_no_coalesce.ll
diff --git a/tests_lit/llvm2ice_tests/returns_twice_no_coalesce.ll b/tests_lit/llvm2ice_tests/returns_twice_no_coalesce.ll
new file mode 100644
index 0000000000000000000000000000000000000000..754a105b01591191e3a267314e3f31a5bacf1722
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/returns_twice_no_coalesce.ll
@@ -0,0 +1,60 @@
+; This file checks that SimpleCoalescing of local stack slots is not done
+; when calling a function with the "returns twice" attribute.
+
+; RUN: %llvm2ice -Om1 --verbose none %s \
+; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \
+; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+
+; Setjmp is a function with the "returns twice" attribute.
+declare i32 @llvm.nacl.setjmp(i8*)
+
+declare i32 @other(i32)
+declare void @user(i32)
+
+define i32 @call_returns_twice(i32 %iptr_jmpbuf, i32 %x) {
+entry:
+ %local = add i32 %x, 12345
+ %jmpbuf = inttoptr i32 %iptr_jmpbuf to i8*
+ %y = call i32 @llvm.nacl.setjmp(i8* %jmpbuf)
+ call void @user(i32 %local)
+ %cmp = icmp eq i32 %y, 0
+ br i1 %cmp, label %Zero, label %NonZero
+Zero:
+ %other_local = add i32 %x, 54321
+ call void @user(i32 %other_local)
+ ret i32 %other_local
+NonZero:
+ ret i32 1
+}
+
+; CHECK-LABEL: call_returns_twice
+; CHECK: add [[REG1:.*]], 12345
+; CHECK: mov dword ptr [esp + [[OFF:.*]]], [[REG1]]
+; CHECK: add [[REG2:.*]], 54321
+; There should not be sharing of the stack slot.
+; CHECK-NOT: mov dword ptr [esp + [[OFF]]], [[REG2]]
+
+define i32 @no_call_returns_twice(i32 %iptr_jmpbuf, i32 %x) {
+entry:
+ %local = add i32 %x, 12345
+ %y = call i32 @other(i32 %x)
+ call void @user(i32 %local)
+ %cmp = icmp eq i32 %y, 0
+ br i1 %cmp, label %Zero, label %NonZero
+Zero:
+ %other_local = add i32 %x, 54321
+ call void @user(i32 %other_local)
+ ret i32 %other_local
+NonZero:
+ ret i32 1
+}
+
+; CHECK-LABEL: no_call_returns_twice
+; CHECK: add [[REG1:.*]], 12345
+; CHECK: mov dword ptr [esp + [[OFF:.*]]], [[REG1]]
+; CHECK: add [[REG2:.*]], 54321
+; Now there should be sharing of the stack slot (OFF is the same).
+; CHECK: mov dword ptr [esp + [[OFF]]], [[REG2]]
+
+; ERRORS-NOT: ICE translation error
« 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