Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
Showing
3 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |