gcc/ChangeLog:

        * config/loongarch/loongarch.cc (loongarch_can_inline_p):
        Do not inline when callee is versioned but caller is not.

Change-Id: I1809df8b4a742effd1799937f72b6bb517adc74c
---
 gcc/config/loongarch/loongarch.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/config/loongarch/loongarch.cc 
b/gcc/config/loongarch/loongarch.cc
index b62f7c644a1..c8ce5c25ab6 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -11255,6 +11255,10 @@ loongarch_compute_pressure_classes (reg_class *classes)
 static bool
 loongarch_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);
 
-- 
2.34.1

Reply via email to