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

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Hmm it is interesting case, we try to resolve speculation while we are
duplicating it. I am testing the following

Index: ipa-inline-analysis.c
===================================================================
--- ipa-inline-analysis.c       (revision 221845)
+++ ipa-inline-analysis.c       (working copy)
@@ -793,7 +793,11 @@ edge_set_predicate (struct cgraph_edge *
 {
   /* If the edge is determined to be never executed, redirect it
      to BUILTIN_UNREACHABLE to save inliner from inlining into it.  */
-  if (predicate && false_predicate_p (predicate))
+  if (predicate && false_predicate_p (predicate)
+      /* When handling speculative edges, we need to do the redirection
+         just once.  Do it always on the direct edge, so we do not
+        attempt to resolve speculation while duplicating the edge.  */
+      && (!e->speculative || e->callee))
     e = redirect_to_unreachable (e);

   struct inline_edge_summary *es = inline_edge_summary (e);

Reply via email to