[llvm] r279251 - [Hexagon] Allow tail-call optimization when mixing C and fast calling conv
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 08:02:18 PDT 2016
Author: kparzysz
Date: Fri Aug 19 10:02:18 2016
New Revision: 279251
URL: http://llvm.org/viewvc/llvm-project?rev=279251&view=rev
Log:
[Hexagon] Allow tail-call optimization when mixing C and fast calling conv
Patch by Arnold Schwaighofer.
Added:
llvm/trunk/test/CodeGen/Hexagon/tailcall_fastcc_ccc.ll
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp?rev=279251&r1=279250&r2=279251&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp Fri Aug 19 10:02:18 2016
@@ -3143,9 +3143,15 @@ bool HexagonTargetLowering::IsEligibleFo
return false;
}
- // Do not optimize if the calling conventions do not match.
- if (!CCMatch)
- return false;
+ // Do not optimize if the calling conventions do not match and the conventions
+ // used are not C or Fast.
+ if (!CCMatch) {
+ bool R = (CallerCC == CallingConv::C || CallerCC == CallingConv::Fast);
+ bool E = (CalleeCC == CallingConv::C || CalleeCC == CallingConv::Fast);
+ // If R & E, then ok.
+ if (!R || !E)
+ return false;
+ }
// Do not tail call optimize vararg calls.
if (isVarArg)
Added: llvm/trunk/test/CodeGen/Hexagon/tailcall_fastcc_ccc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/tailcall_fastcc_ccc.ll?rev=279251&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/tailcall_fastcc_ccc.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/tailcall_fastcc_ccc.ll Fri Aug 19 10:02:18 2016
@@ -0,0 +1,22 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+
+target triple = "hexagon"
+
+declare hidden fastcc void @callee(i32, i32) #0
+declare hidden void @callee2(i32, i32) #0
+
+; CHECK: jump callee
+define void @caller(i32 %pp) #0 {
+entry:
+ tail call fastcc void @callee(i32 %pp, i32 0)
+ ret void
+}
+
+; CHECK: jump callee2
+define void @caller2(i32 %pp) #0 {
+entry:
+ tail call fastcc void @callee2(i32 %pp, i32 0)
+ ret void
+}
+
+attributes #0 = { nounwind }
More information about the llvm-commits
mailing list