blob: c3e79652c035119b7afeb95d415520c9302e8b3b [file] [log] [blame]
Stephen Hines36b56882014-04-23 16:57:46 -07001; RUN: llc -mtriple armv7 -O0 -o - < %s | FileCheck %s -check-prefix CHECK-TAIL
2; RUN: llc -mtriple armv7 -O0 -disable-tail-calls -o - < %s \
3; RUN: | FileCheck %s -check-prefix CHECK-NO-TAIL
4
5declare i32 @callee(i32 %i)
Stephen Hines37ed9c12014-12-01 14:51:49 -08006declare extern_weak fastcc void @callee_weak()
Stephen Hines36b56882014-04-23 16:57:46 -07007
8define i32 @caller(i32 %i) {
9entry:
10 %r = tail call i32 @callee(i32 %i)
11 ret i32 %r
12}
13
14; CHECK-TAIL-LABEL: caller
15; CHECK-TAIL: b callee
16
17; CHECK-NO-TAIL-LABEL: caller
18; CHECK-NO-TAIL: push {lr}
19; CHECK-NO-TAIL: bl callee
20; CHECK-NO-TAIL: pop {lr}
21; CHECK-NO-TAIL: bx lr
22
Stephen Hines37ed9c12014-12-01 14:51:49 -080023
24; Weakly-referenced extern functions cannot be tail-called, as AAELF does
25; not define the behaviour of branch instructions to undefined weak symbols.
26define fastcc void @caller_weak() {
27; CHECK-LABEL: caller_weak:
28; CHECK: bl callee_weak
29 tail call void @callee_weak()
30 ret void
31}