summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSanne Wouda <sanne.wouda@arm.com>2017-02-03 11:15:53 +0000
committerSanne Wouda <sanne.wouda@arm.com>2017-02-03 11:15:53 +0000
commita9941857579f17057994a270dba17fee6b9fd281 (patch)
tree3f341d0b562dff4521313aa1b179ca54916e53a4 /llvm/test
parent57b63d6ade0f370b47c422ea62c0bdce5467f3c7 (diff)
downloadbcm5719-llvm-a9941857579f17057994a270dba17fee6b9fd281.tar.gz
bcm5719-llvm-a9941857579f17057994a270dba17fee6b9fd281.zip
[ARM] Change TCReturn to tBL if tailcall optimization fails.
Summary: The tail call optimisation is performed before register allocation, so at that point we don't know if LR is being spilt or not. If LR was spilt to the stack, then we cannot do a tail call optimisation. That would involve popping back into LR which is not possible in Thumb1 code. Reviewers: rengolin, jmolloy, rovka, olista01 Reviewed By: olista01 Subscribers: llvm-commits, aemerson Differential Revision: https://reviews.llvm.org/D29020 llvm-svn: 294000
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/ARM/v8m-tail-call.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/v8m-tail-call.ll b/llvm/test/CodeGen/ARM/v8m-tail-call.ll
new file mode 100644
index 00000000000..2c2c795838f
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/v8m-tail-call.ll
@@ -0,0 +1,23 @@
+; RUN: llc %s -o - -mtriple=thumbv8m.base | FileCheck %s
+
+define void @test() {
+; CHECK-LABEL: test:
+entry:
+ %call = tail call i32 @foo()
+ %tail = tail call i32 @foo()
+ ret void
+; CHECK: bl foo
+; CHECK: bl foo
+; CHECK-NOT: b foo
+}
+
+define void @test2() {
+; CHECK-LABEL: test2:
+entry:
+ %tail = tail call i32 @foo()
+ ret void
+; CHECK: b foo
+; CHECK-NOT: bl foo
+}
+
+declare i32 @foo()
OpenPOWER on IntegriCloud