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)
--- /dev/null
+; 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 }