summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-12-02 16:42:33 -0800
committerReid Kleckner <rnk@google.com>2020-01-03 11:27:41 -0800
commit9c2b72821be64db7795dd18586c2ae7edb905c21 (patch)
treef80ab96f0c8ee84a36f5a08399f5ed73c2d07e9f /llvm/test
parente5a56f2d50ce1939eba4fddbeb9c8e032db4fc95 (diff)
downloadbcm5719-llvm-9c2b72821be64db7795dd18586c2ae7edb905c21.tar.gz
bcm5719-llvm-9c2b72821be64db7795dd18586c2ae7edb905c21.zip
Move tail call disabling code to target independent code
When the "disable-tail-calls" attribute was added, checks were added for it in various backends. Now this code has proliferated, and it is something the target is responsible for checking. Move that responsibility back to the ISels (fast, global, and SD). There's no major functionality change, except for targets that never implemented this check. This LLVM attribute was originally added in d9699bc7bdf0362173fcd256690f61a4d47429c2 (2015). Reviewers: echristo, MaskRay Differential Revision: https://reviews.llvm.org/D72118
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/AArch64/tail-call.ll10
-rw-r--r--llvm/test/CodeGen/RISCV/tail-calls.ll10
2 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/tail-call.ll b/llvm/test/CodeGen/AArch64/tail-call.ll
index f1c5daf86c9..39a9a711871 100644
--- a/llvm/test/CodeGen/AArch64/tail-call.ll
+++ b/llvm/test/CodeGen/AArch64/tail-call.ll
@@ -93,6 +93,16 @@ define fastcc void @caller_to16_from16([8 x i64], i64 %a, i64 %b) {
; COMMON-NEXT: b callee_stack16
}
+define fastcc void @disable_tail_calls() nounwind "disable-tail-calls"="true" {
+; COMMON-LABEL: disable_tail_calls:
+; COMMON-NEXT: // %bb.
+
+ tail call fastcc void @callee_stack0()
+ ret void
+
+; COMMON: bl callee_stack0
+; COMMON: ret
+}
; Weakly-referenced extern functions cannot be tail-called, as AAELF does
; not define the behaviour of branch instructions to undefined weak symbols.
diff --git a/llvm/test/CodeGen/RISCV/tail-calls.ll b/llvm/test/CodeGen/RISCV/tail-calls.ll
index 30e530b5116..14af16ed3c8 100644
--- a/llvm/test/CodeGen/RISCV/tail-calls.ll
+++ b/llvm/test/CodeGen/RISCV/tail-calls.ll
@@ -158,6 +158,16 @@ entry:
ret void
}
+; Do not tail call optimize if disabled.
+define i32 @disable_tail_calls(i32 %i) nounwind "disable-tail-calls"="true" {
+; CHECK-LABEL: disable_tail_calls:
+; CHECK-NOT: tail callee_nostruct
+; CHECK: call callee_tail
+entry:
+ %rv = tail call i32 @callee_tail(i32 %i)
+ ret i32 %rv
+}
+
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"ProfileSummary", !1}
!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
OpenPOWER on IntegriCloud