summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2015-01-03 21:35:00 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2015-01-03 21:35:00 +0000
commit67f729933f22240b1fd516327425bc3d25d40e90 (patch)
tree83986b4f5eeebab5d0b3965cbe23e8f86fb3841b /llvm/test/CodeGen
parent22fe771f78c957e0c1a2f28e31f7129497a3915f (diff)
downloadbcm5719-llvm-67f729933f22240b1fd516327425bc3d25d40e90.tar.gz
bcm5719-llvm-67f729933f22240b1fd516327425bc3d25d40e90.zip
ARM: permit tail calls to weak externals on COFF
Weak externals are resolved statically, so we can actually generate the tail call on PE/COFF targets without breaking the requirements. It is questionable whether we want to propagate the current behaviour for MachO as the requirements are part of the ARM ELF specifications, and it seems that prior to the SVN r215890, we would have tail'ed the call. For now, be conservative and only permit it on PE/COFF where the call will always be fully resolved. llvm-svn: 225119
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/ARM/tail-call-weak.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/tail-call-weak.ll b/llvm/test/CodeGen/ARM/tail-call-weak.ll
new file mode 100644
index 00000000000..466c33d3878
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/tail-call-weak.ll
@@ -0,0 +1,19 @@
+; RUN: llc -mtriple thumbv7-windows-coff -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-COFF
+; RUN: llc -mtriple thumbv7-elf -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-ELF
+; RUN: llc -mtriple thumbv7-macho -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MACHO
+
+declare i8* @f()
+declare extern_weak i8* @g(i8*)
+
+; weak symbol resolution occurs statically in PE/COFF, ensure that we permit
+; tail calls on weak externals when targeting a COFF environment.
+define void @test() {
+ %call = tail call i8* @f()
+ %call1 = tail call i8* @g(i8* %call)
+ ret void
+}
+
+; CHECK-COFF: b g
+; CHECK-ELF: bl g
+; CHECK-MACHO: blx _g
+
OpenPOWER on IntegriCloud