[llvm] r203575 - ARM: enable tail call optimisation on Thumb 2

Saleem Abdulrasool compnerd at compnerd.org
Tue Mar 11 08:09:44 PDT 2014


Author: compnerd
Date: Tue Mar 11 10:09:44 2014
New Revision: 203575

URL: http://llvm.org/viewvc/llvm-project?rev=203575&view=rev
Log:
ARM: enable tail call optimisation on Thumb 2

Tail call optimisation was previously disabled on all targets other than
iOS5.0+.  This enables the tail call optimisation on all Thumb 2 capable
platforms.

The test adjustments are to remove the IR hint "tail" to function invocation.
The tests were designed assuming that tail call optimisations would not kick in
which no longer holds true.

Modified:
    llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp
    llvm/trunk/test/CodeGen/ARM/2013-04-16-AAPCS-C4-vs-VFP.ll
    llvm/trunk/test/CodeGen/ARM/2014-02-21-byval-reg-split-alignment.ll
    llvm/trunk/test/CodeGen/ARM/debug-frame.ll
    llvm/trunk/test/CodeGen/ARM/ehabi.ll
    llvm/trunk/test/CodeGen/ARM/v1-constant-fold.ll

Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=203575&r1=203574&r2=203575&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Tue Mar 11 10:09:44 2014
@@ -219,8 +219,10 @@ void ARMSubtarget::resetSubtargetFeature
   if (isTargetMachO()) {
     IsR9Reserved = ReserveR9 | !HasV6Ops;
     SupportsTailCall = !isTargetIOS() || !getTargetTriple().isOSVersionLT(5, 0);
-  } else
+  } else {
     IsR9Reserved = ReserveR9;
+    SupportsTailCall = !isThumb1Only();
+  }
 
   if (!isThumb() || hasThumb2())
     PostRAScheduler = true;

Modified: llvm/trunk/test/CodeGen/ARM/2013-04-16-AAPCS-C4-vs-VFP.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2013-04-16-AAPCS-C4-vs-VFP.ll?rev=203575&r1=203574&r2=203575&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2013-04-16-AAPCS-C4-vs-VFP.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/2013-04-16-AAPCS-C4-vs-VFP.ll Tue Mar 11 10:09:44 2014
@@ -72,7 +72,7 @@ define void @foo(double %p0, ; --> D0
 		 double %p8, ; --> Stack
 		 i32 %p9) #0 { ; --> R0, not Stack+8
 entry:
-  tail call void @fooUseI32(i32 %p9)
+  call void @fooUseI32(i32 %p9)
   ret void
 }
 

Modified: llvm/trunk/test/CodeGen/ARM/2014-02-21-byval-reg-split-alignment.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2014-02-21-byval-reg-split-alignment.ll?rev=203575&r1=203574&r2=203575&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2014-02-21-byval-reg-split-alignment.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/2014-02-21-byval-reg-split-alignment.ll Tue Mar 11 10:09:44 2014
@@ -23,7 +23,7 @@ define void @foo1(i32 %a, %struct12bytes
 ; CHECK: pop  {r11, lr}
 ; CHECK: add  sp, sp, #16
 
-  tail call void @useLong(i64 %c)
+  call void @useLong(i64 %c)
   ret void
 }
 
@@ -40,7 +40,7 @@ define void @foo2(i32 %a, %struct8bytes8
 ; CHECK: pop  {r11, lr}
 ; CHECK: add  sp, sp, #8
 
-  tail call void @usePtr(%struct8bytes8align* %b)
+  call void @usePtr(%struct8bytes8align* %b)
   ret void
 }
 
@@ -57,7 +57,7 @@ define void @foo3(%struct8bytes8align* b
 ; CHECK: pop  {r11, lr}
 ; CHECK: add  sp, sp, #16
 
-  tail call void @usePtr(%struct8bytes8align* %a)
+  call void @usePtr(%struct8bytes8align* %a)
   ret void
 }
 
@@ -76,7 +76,7 @@ define void @foo4(%struct4bytes* byval %
 ; CHECK: add     sp, sp, #16
 ; CHECK: mov     pc, lr
 
-  tail call void @usePtr(%struct8bytes8align* %b)
+  call void @usePtr(%struct8bytes8align* %b)
   ret void
 }
 
@@ -95,7 +95,7 @@ define void @foo5(%struct8bytes8align* b
 ; CHECK: add     sp, sp, #16
 ; CHECK: mov     pc, lr
 
-  tail call void @usePtr(%struct8bytes8align* %a)
+  call void @usePtr(%struct8bytes8align* %a)
   ret void
 }
 
@@ -109,6 +109,6 @@ define void @foo6(i32 %a, i32 %b, i32 %c
 ; CHECK: pop  {r11, lr}
 ; CHECK: mov  pc, lr
 
-  tail call void @usePtr(%struct8bytes8align* %d)
+  call void @usePtr(%struct8bytes8align* %d)
   ret void
 }

Modified: llvm/trunk/test/CodeGen/ARM/debug-frame.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/debug-frame.ll?rev=203575&r1=203574&r2=203575&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/debug-frame.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/debug-frame.ll Tue Mar 11 10:09:44 2014
@@ -301,7 +301,7 @@ declare void @throw_exception_2()
 
 define void @test2() {
 entry:
-  tail call void @throw_exception_2()
+  call void @throw_exception_2()
   ret void
 }
 

Modified: llvm/trunk/test/CodeGen/ARM/ehabi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ehabi.ll?rev=203575&r1=203574&r2=203575&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/ehabi.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/ehabi.ll Tue Mar 11 10:09:44 2014
@@ -181,7 +181,7 @@ declare void @throw_exception_2()
 
 define void @test2() {
 entry:
-  tail call void @throw_exception_2()
+  call void @throw_exception_2()
   ret void
 }
 

Modified: llvm/trunk/test/CodeGen/ARM/v1-constant-fold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/v1-constant-fold.ll?rev=203575&r1=203574&r2=203575&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/v1-constant-fold.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/v1-constant-fold.ll Tue Mar 11 10:09:44 2014
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi -mattr=+v7,+vfp3,-neon  | FileCheck %s
+; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi -mattr=+v7,+vfp3,-neon | FileCheck %s
 
 ; PR15611. Check that we don't crash when constant folding v1i32 types.
 
@@ -11,7 +11,7 @@ bb:
   %tmp3 = insertelement <4 x i32> %tmp2, i32 0, i32 3
   %tmp4 = add <4 x i32> %tmp3, <i32 -1, i32 -1, i32 -1, i32 -1>
 ; CHECK:  bl bar
-  tail call void @bar(<4 x i32> %tmp4)
+  call void @bar(<4 x i32> %tmp4)
   ret void
 }
 





More information about the llvm-commits mailing list