summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-05-15 00:26:21 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-05-15 00:26:21 +0000
commit2c2661456e3c89c2b2287c050515be3f5b906c87 (patch)
treeb8aee7809aa1e2378609ff1d490d96351ae76cdb /llvm/test
parent8045810c58be96981cf5483f20e9aed3e98b505c (diff)
downloadbcm5719-llvm-2c2661456e3c89c2b2287c050515be3f5b906c87.tar.gz
bcm5719-llvm-2c2661456e3c89c2b2287c050515be3f5b906c87.zip
[PlaceSafepoints] Fix a bug that came in with rL236672.
Transfer the calling convention from the invoke being replaced by PlaceStatepoints to the new invoke to gc.statepoint created. Add a test case that would have caught this issue. llvm-svn: 237414
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/PlaceSafepoints/statepoint-calling-conventions.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/Transforms/PlaceSafepoints/statepoint-calling-conventions.ll b/llvm/test/Transforms/PlaceSafepoints/statepoint-calling-conventions.ll
new file mode 100644
index 00000000000..e31c2aa5166
--- /dev/null
+++ b/llvm/test/Transforms/PlaceSafepoints/statepoint-calling-conventions.ll
@@ -0,0 +1,42 @@
+; RUN: opt -place-safepoints -S < %s | FileCheck %s
+
+; Ensure that the gc.statepoint calls / invokes we generate carry over
+; the right calling conventions.
+
+define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" {
+; CHECK-LABEL: @test_invoke_format(
+; CHECK-LABEL: entry:
+; CHECK: invoke coldcc i32 (i64, i32, i64 addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64 2882400000, i32 0, i64 addrspace(1)* (i64 addrspace(1)*)* @callee, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 0)
+entry:
+ %ret_val = invoke coldcc i64 addrspace(1)* @callee(i64 addrspace(1)* %obj)
+ to label %normal_return unwind label %exceptional_return
+
+normal_return:
+ ret i64 addrspace(1)* %ret_val
+
+exceptional_return:
+ %landing_pad4 = landingpad {i8*, i32} personality i32 ()* @personality
+ cleanup
+ ret i64 addrspace(1)* %obj1
+}
+
+define i64 addrspace(1)* @test_call_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" {
+; CHECK-LABEL: @test_call_format(
+; CHECK-LABEL: entry:
+; CHECK: call coldcc i32 (i64, i32, i64 addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64 2882400000, i32 0, i64 addrspace(1)* (i64 addrspace(1)*)* @callee, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 0)
+entry:
+ %ret_val = call coldcc i64 addrspace(1)* @callee(i64 addrspace(1)* %obj)
+ ret i64 addrspace(1)* %ret_val
+}
+
+; This function is inlined when inserting a poll.
+declare void @do_safepoint()
+define void @gc.safepoint_poll() {
+; CHECK-LABEL: gc.safepoint_poll
+entry:
+ call void @do_safepoint()
+ ret void
+}
+
+declare coldcc i64 addrspace(1)* @callee(i64 addrspace(1)*)
+declare i32 @personality()
OpenPOWER on IntegriCloud