• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple armv7 -target-abi apcs -O0 -o - < %s \
2; RUN:   | FileCheck %s -check-prefix CHECK-TAIL
3; RUN: llc -mtriple armv7 -target-abi apcs -O0 -disable-tail-calls -o - < %s \
4; RUN:   | FileCheck %s -check-prefix CHECK-NO-TAIL
5
6declare i32 @callee(i32 %i)
7declare extern_weak fastcc void @callee_weak()
8
9define i32 @caller(i32 %i) {
10entry:
11  %r = tail call i32 @callee(i32 %i)
12  ret i32 %r
13}
14
15; CHECK-TAIL-LABEL: caller
16; CHECK-TAIL: b callee
17
18; CHECK-NO-TAIL-LABEL: caller
19; CHECK-NO-TAIL: push {lr}
20; CHECK-NO-TAIL: bl callee
21; CHECK-NO-TAIL: pop {lr}
22; CHECK-NO-TAIL: bx lr
23
24
25; Weakly-referenced extern functions cannot be tail-called, as AAELF does
26; not define the behaviour of branch instructions to undefined weak symbols.
27define fastcc void @caller_weak() {
28; CHECK-LABEL: caller_weak:
29; CHECK: bl callee_weak
30  tail call void @callee_weak()
31  ret void
32}
33