- call_block = BLOCK_FOR_INSN (insn);
-
- /* If the block has more than one successor, then we can not
- perform sibcall or tail recursion optimizations. */
- if (call_block->succ == NULL
- || call_block->succ->succ_next != NULL)
- goto failure;
-
- /* If the single successor is not the exit block, then we can not
- perform sibcall or tail recursion optimizations.
-
- Note that this test combined with the previous is sufficient
- to prevent tail call optimization in the presense of active
- exception handlers. */
- succ_block = call_block->succ->dest;
- if (succ_block != EXIT_BLOCK_PTR && succ_block != alternate_exit)
- goto failure;
-
- /* If the call was the end of the block, then we're OK. */
- temp = insn;
- if (temp == call_block->end)
- goto success;
-
- /* Skip over copying from the call's return value pseudo into
- this function's hard return register. */
- if (identify_call_return_value (PATTERN (insn), &hardret, &softret))
- {
- temp = skip_copy_to_return_value (temp, hardret, softret);
- if (temp == call_block->end)
- goto success;
- }
-
- /* Skip any stack adjustment. */
- temp = skip_stack_adjustment (temp);
- if (temp == call_block->end)
- goto success;
-
- /* Skip over a CLOBBER of the return value (as a hard reg). */
- temp = skip_use_of_return_value (temp, CLOBBER);
- if (temp == call_block->end)
- goto success;
-
- /* Skip over a USE of the return value (as a hard reg). */
- temp = skip_use_of_return_value (temp, USE);
- if (temp == call_block->end)
- goto success;
-
- /* Skip over the JUMP_INSN at the end of the block. */
- temp = skip_jump_insn (temp);
- if (GET_CODE (temp) == NOTE)
- temp = next_nonnote_insn (temp);
- if (temp == call_block->end)
- goto success;
-
- /* There are operations at the end of the block which we must
- execute after returning from the function call. So this call
- can not be optimized. */
-failure:
- sibcall = 0, tailrecursion = 0;
-success:
+ /* See if there are any reasons we can't perform either sibling or
+ tail call optimizations. We must be careful with stack slots
+ which are live at potential optimization sites. */
+ if (no_sibcalls_this_function
+ /* ??? Overly conservative. */
+ || frame_offset
+ /* Any function that calls setjmp might have longjmp called from
+ any called function. ??? We really should represent this
+ properly in the CFG so that this needn't be special cased. */
+ || current_function_calls_setjmp
+ /* Can't if more than one successor or single successor is not
+ exit block. These two tests prevent tail call optimization
+ in the presence of active exception handlers. */
+ || call_block->succ == NULL
+ || call_block->succ->succ_next != NULL
+ || (call_block->succ->dest != EXIT_BLOCK_PTR
+ && call_block->succ->dest != alternate_exit)
+ /* If this call doesn't end the block, there are operations at
+ the end of the block which we must execute after returning. */
+ || ! call_ends_block_p (insn, BB_END (call_block)))
+ sibcall = 0, tailrecursion = 0;