diff options
| author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-10-16 03:27:30 +0000 |
|---|---|---|
| committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-10-16 03:27:30 +0000 |
| commit | 7f52921976906112e9022006a1ca47cf80b16bc6 (patch) | |
| tree | 11d5c7a0c332bc01c9031196b84efacc8b64b79a /llvm/test/Transforms/TailCallElim | |
| parent | ce842e8c4a4daa48e8aa71336db7797ea91520dc (diff) | |
| download | bcm5719-llvm-7f52921976906112e9022006a1ca47cf80b16bc6.tar.gz bcm5719-llvm-7f52921976906112e9022006a1ca47cf80b16bc6.zip | |
TRE: make TRE a bit more aggressive
Make tail recursion elimination a bit more aggressive. This allows us to get
tail recursion on functions that are just branches to a different function. The
fact that the function takes a byval argument does not restrict it from being
optimised into just a tail call.
llvm-svn: 219899
Diffstat (limited to 'llvm/test/Transforms/TailCallElim')
| -rw-r--r-- | llvm/test/Transforms/TailCallElim/basic.ll | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/TailCallElim/byval.ll | 34 |
2 files changed, 35 insertions, 1 deletions
diff --git a/llvm/test/Transforms/TailCallElim/basic.ll b/llvm/test/Transforms/TailCallElim/basic.ll index 8e9814b52bb..c7af9af5be7 100644 --- a/llvm/test/Transforms/TailCallElim/basic.ll +++ b/llvm/test/Transforms/TailCallElim/basic.ll @@ -147,7 +147,7 @@ cond_false: ; Don't tail call if a byval arg is captured. define void @test9(i32* byval %a) { ; CHECK-LABEL: define void @test9( -; CHECK: {{^ *}}call void @use( +; CHECK: {{^ *}}tail call void @use( call void @use(i32* %a) ret void } diff --git a/llvm/test/Transforms/TailCallElim/byval.ll b/llvm/test/Transforms/TailCallElim/byval.ll new file mode 100644 index 00000000000..1150f7684e9 --- /dev/null +++ b/llvm/test/Transforms/TailCallElim/byval.ll @@ -0,0 +1,34 @@ +; RUN: opt -mtriple i386 -Os -S %s -o - | FileCheck %s +; RUN: opt -mtriple x86_64 -Os -S %s -o - | FileCheck %s +; RUN: opt -mtriple armv7 -Os -S %s -o - | FileCheck %s + +%struct.D16 = type { [16 x double] } + +declare void @_Z2OpP3D16PKS_S2_(%struct.D16*, %struct.D16*, %struct.D16*) + +define void @_Z7TestRefRK3D16S1_(%struct.D16* noalias sret %agg.result, %struct.D16* %RHS, %struct.D16* %LHS) { + %1 = alloca %struct.D16*, align 8 + %2 = alloca %struct.D16*, align 8 + store %struct.D16* %RHS, %struct.D16** %1, align 8 + store %struct.D16* %LHS, %struct.D16** %2, align 8 + %3 = load %struct.D16** %1, align 8 + %4 = load %struct.D16** %2, align 8 + call void @_Z2OpP3D16PKS_S2_(%struct.D16* %agg.result, %struct.D16* %3, %struct.D16* %4) + ret void +} + +; CHECK: define void @_Z7TestRefRK3D16S1_({{.*}}) { +; CHECK: tail call void @_Z2OpP3D16PKS_S2_(%struct.D16* %agg.result, %struct.D16* %RHS, %struct.D16* %LHS) +; CHECK: ret void +; CHECK: } + +define void @_Z7TestVal3D16S_(%struct.D16* noalias sret %agg.result, %struct.D16* byval align 8 %RHS, %struct.D16* byval align 8 %LHS) { + call void @_Z2OpP3D16PKS_S2_(%struct.D16* %agg.result, %struct.D16* %RHS, %struct.D16* %LHS) + ret void +} + +; CHECK: define void @_Z7TestVal3D16S_({{.*}}) { +; CHECK: tail call void @_Z2OpP3D16PKS_S2_(%struct.D16* %agg.result, %struct.D16* %RHS, %struct.D16* %LHS) +; CHECK: ret void +; CHECK: } + |

