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

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Return BB is special cased, but it only permits PHI and the def of return
variable:

/* Return basic block containing RETURN statement.  We allow basic blocks
   of the form:
   <retval> = tmp_var;
   return <retval>        
   but return_bb cannot be more complex than this (except for
   -fsanitize=thread we allow TSAN_FUNC_EXIT () internal call in there).
   If nothing is found, return the exit block.

   When there are multiple RETURN statement, chose one with return value,
   since that one is more likely shared by multiple code paths.

   Return BB is special, because for function splitting it is the only
   basic block that is duplicated in between header and split part of the
   function.

   TODO: We might support multiple return blocks.  */

static basic_block
find_return_bb (void)


One problem with allowing more general code here is that in many cases we split
and later inline back that would result in code duplication and we are not that
good on deduplication...

We may implement splitting of general cold SESE regions (LLVM has that and
tries to replace by it the function partitioning).  This was not that easy to
implement long time ago when IPA-Split was written since we did not have ways
to offline general parts of function body and introduce function parameters.

Reply via email to