mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[Hexagon] Allow tail-call optimization when mixing C and fast calling conv
Patch by Arnold Schwaighofer. llvm-svn: 279251
This commit is contained in:
parent
6c216ccafc
commit
7674324b11
@ -3143,9 +3143,15 @@ bool HexagonTargetLowering::IsEligibleForTailCallOptimization(
|
||||
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)
|
||||
|
22
test/CodeGen/Hexagon/tailcall_fastcc_ccc.ll
Normal file
22
test/CodeGen/Hexagon/tailcall_fastcc_ccc.ll
Normal file
@ -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 }
|
Loading…
x
Reference in New Issue
Block a user