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

--- Comment #5 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
GCC discovers that 'bar' is noreturn, tries to remove its LHS but unfortunately
cgraph.cc:cgraph_edge::redirect_call_stmt_to_callee wants to emit an assignment
of SSA default-def to the LHS. fixup_noreturn_call seems to handle that in a
smarter way.

Is it possible to simply let fixup_noreturn_call do its thing?

diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 8d6ed38ef..6597de669 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -1567,7 +1567,7 @@ cgraph_edge::redirect_call_stmt_to_callee (cgraph_edge
*e)

   /* If the call becomes noreturn, remove the LHS if possible.  */
   tree lhs = gimple_call_lhs (new_stmt);
-  if (lhs
+  if (0 && lhs
       && gimple_call_noreturn_p (new_stmt)
       && (VOID_TYPE_P (TREE_TYPE (gimple_call_fntype (new_stmt)))
          || should_remove_lhs_p (lhs)))

Reply via email to