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

--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> ---
All right, this is a different bug, the description in the summary describes it
fairly precisely.  To the extent to which I am still awake, I believe the fix
is the patch below.  I will test it properly tomorrow. 

diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 4e0e20af409..4a3c9a84e73 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -3491,7 +3491,9 @@ cgraph_edge_brings_value_p (cgraph_edge *cs,
ipcp_value_source<tree> *src,
     return false;
   /* At the moment we do not propagate over arithmetic jump functions in SCCs,
      so it is safe to detect self-feeding recursive calls in this way.  */
-  if (!src->val || src->val == dest_val)
+  if (!src->val ||
+      (src->val == dest_val
+       && !caller_info->ipcp_orig_node))
     return true;

   if (caller_info->ipcp_orig_node)

Reply via email to