- /* If C has a tail recursion label, do not merge. There is no
- edge recorded from the call_placeholder back to this label, as
- that would make optimize_sibling_and_tail_recursive_calls more
- complex for no gain. */
- if ((mode & CLEANUP_PRE_SIBCALL)
- && GET_CODE (BB_HEAD (c)) == CODE_LABEL
- && tail_recursion_label_p (BB_HEAD (c)))
+
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections.
+
+ Basic block partitioning may result in some jumps that appear to
+ be optimizable (or blocks that appear to be mergeable), but which really
+ must be left untouched (they are required to make it safely across
+ partition boundaries). See the comments at the top of
+ bb-reorder.c:partition_hot_cold_basic_blocks for complete details. */
+
+ if (flag_reorder_blocks_and_partition
+ && (find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX)
+ || find_reg_note (BB_END (c), REG_CROSSING_JUMP, NULL_RTX)
+ || BB_PARTITION (b) != BB_PARTITION (c)))