2014-12-18 02:08:45 +00:00
|
|
|
; RUN: llc -mtriple armv7 -mattr=apcs -O0 -o - < %s \
|
|
|
|
; RUN: | FileCheck %s -check-prefix CHECK-TAIL
|
|
|
|
; RUN: llc -mtriple armv7 -mattr=apcs -O0 -disable-tail-calls -o - < %s \
|
2014-03-11 15:09:54 +00:00
|
|
|
; RUN: | FileCheck %s -check-prefix CHECK-NO-TAIL
|
|
|
|
|
|
|
|
declare i32 @callee(i32 %i)
|
2014-08-18 12:42:15 +00:00
|
|
|
declare extern_weak fastcc void @callee_weak()
|
2014-03-11 15:09:54 +00:00
|
|
|
|
|
|
|
define i32 @caller(i32 %i) {
|
|
|
|
entry:
|
|
|
|
%r = tail call i32 @callee(i32 %i)
|
|
|
|
ret i32 %r
|
|
|
|
}
|
|
|
|
|
2014-03-25 03:39:39 +00:00
|
|
|
; CHECK-TAIL-LABEL: caller
|
2014-03-11 15:09:54 +00:00
|
|
|
; CHECK-TAIL: b callee
|
|
|
|
|
2014-03-25 03:39:39 +00:00
|
|
|
; CHECK-NO-TAIL-LABEL: caller
|
2014-03-11 15:09:54 +00:00
|
|
|
; CHECK-NO-TAIL: push {lr}
|
|
|
|
; CHECK-NO-TAIL: bl callee
|
|
|
|
; CHECK-NO-TAIL: pop {lr}
|
|
|
|
; CHECK-NO-TAIL: bx lr
|
|
|
|
|
2014-08-18 12:42:15 +00:00
|
|
|
|
|
|
|
; Weakly-referenced extern functions cannot be tail-called, as AAELF does
|
|
|
|
; not define the behaviour of branch instructions to undefined weak symbols.
|
|
|
|
define fastcc void @caller_weak() {
|
|
|
|
; CHECK-LABEL: caller_weak:
|
|
|
|
; CHECK: bl callee_weak
|
|
|
|
tail call void @callee_weak()
|
|
|
|
ret void
|
|
|
|
}
|