https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127365

--- Comment #1 from Zhou Qiankang <wszqkzqk at qq dot com> ---
I've created a patch to fix on Arch Linux for Loong64 but I'm not sure whether
it's proper.

```diff
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -6026,10 +6026,11 @@ decide_about_value (struct cgraph_node *node, int
index, HOST_WIDE_INT offset,
   find_contexts_for_caller_subset (avals.m_known_contexts, info, callers);
   find_aggregate_values_for_callers_subset (avals.m_known_aggs, node,
callers);

-
-  if (good_cloning_opportunity_p (node, val->prop_time_benefit,
-                                 freq_sum, count_sum, val->prop_size_cost,
-                                 called_without_ipa_profile, cur_sweep))
+  if (val->prop_size_cost <= 0
+      ? val->prop_time_benefit > 0
+      : good_cloning_opportunity_p (node, val->prop_time_benefit,
+                                   freq_sum, count_sum, val->prop_size_cost,
+                                   called_without_ipa_profile, cur_sweep))
     ;
   else
     {
```

Reply via email to