When the callee is versioned but the caller is not, we should not inline
the callee into the caller, to prevent the default version of the callee
from being inlined into a not versioned caller.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_can_inline_p): Refuse to inline
when callee is versioned but caller is not.
static bool
riscv_can_inline_p (tree caller, tree callee)
{
+ /* Do not inline when callee is versioned but caller is not. */
+ if (DECL_FUNCTION_VERSIONED (callee) && ! DECL_FUNCTION_VERSIONED (caller))
+ return false;
+
tree callee_tree = DECL_FUNCTION_SPECIFIC_TARGET (callee);
tree caller_tree = DECL_FUNCTION_SPECIFIC_TARGET (caller);