This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Remove insn scanning from hot/cold partitioning...



This patch should address all the remaining issues with hot/cold partitioning EXCEPT for making
it work with dwarf debug format (that will be forthcoming soon). I believe this patch is appropriate for
stage 3, as it is a bug/feature fixing patch, but if I am mistaken, I apologize.


This patch includes all of the following unreviewed patch (from Aug. 31), which is required to make
everything work:


http://gcc.gnu.org/ml/gcc-patches/2004-08/msg02673.html
"Change function_section to allow partitioning w/o insn stream scanning"

The patch I am currently submitting fixes or addresses the following concerns with respect to hot/cold
basic block partitioning. If anybody believes there is an issue or concern that needs to be addressed
which I have overlooked, please let me know:


- Make sure there is at most one cluster of hot blocks and one cluster of cold blocks within a function,
with a single boundary between them.
- Use a single NOTE_INSN_UNLIKELY_EXECUTED_CODE note to mark the beginning of the cold
section (rather than attaching the note to each cold block).
- Remove some redundant test conditions within the cfg optimizations for determining when to disallow the
optimizations.
- Remove code for scanning instruction stream to determine which section code belongs in (rely on
single boundary instead).
- Make sure cold section label prints out in correct place.


[ From previous unreviewed patch]:
- Split function_section into two functions, and change calls to function_section where appropriate.



I have tested this code on both a G4 running powerpc-apple-darwin, and an x86 running Linux. It has
passed a profiledbootstrap (with partitioning turned on), DejaGnu tests, SPEC benchmark tests (with
partitioning turned on), and my own small partitioning test on both architectures.


Is this okay to commit to FSF mainline?

-- Caroline Tice
ctice@apple.com

2004-09-16 Caroline Tice <ctice@apple.com>

* Makefile.in (varasm.o): Add basic-block.h to list of requirements.
(bb-reorder.o): Add errors.h to list of requirements.
* bb-reorder.c (errors.h): Add new include.
(struct bbro_basic_block_data_def): Add new field, in_trace.
(add_unlikely_executed_notes): Remove function.
(mark_bb_for_unlikely_executed_section): Remove function.
(add_remaining_hot_blocks_to_heap): New function.
(insert_cold_section_boundary_note): New function.
(verify_hot_cold_block_grouping): New function.
(find_traces): Add and initialize local variable, last_hot_round;
add call to add_remaining_hot_blocks_to_heap (when appropriate).
(find_traces_1_round) : Add code to update new struct field;
correct trace_length where it was incorrect before (after call to
copy_bb).
(bb_to_key): Add code to force first block in function to be first
block in traces, even when the block is cold.
(fix_edges_for_rarely_executed_code): Update comment describing
function.
(reorder_basic_blocks): Add code to initialize new field (in_trace);
remove call to add_unlikely_executed_notes; add call to
verify_hot_cold_block_grouping.
(partition_hot_cold_basic_blocks): Update function comment.
* cfgcleanup.c (try_simplify_condjump): Remove redundacy from condition.
(try_forward_edges): Likewise.
(merge_blocks_move_predecessor_nojumps): Likewise.
(merge_blocks_move_successor_nojumps): Likewise.
(merge_blocks_move): Likewise.
(try_crossjump_bb): Likewise.
* cfglayout.c (update_unlikely_executed_notes): Remove function.
(fixup_reorder_chain): Remove code for adding UNLIKELY_EXECUTED_CODE
notes to cold bb's; remove call to update_unlikely_executed_notes.
* cfglayout.h (scan_ahead_for_unlikely_executed_note): Remove
function declaration.
* cfgrtl.c (can_delete_note_p): Remove UNLIKELY_EXECUTED_CODE note
from consideration.
(rtl_can_merge_blocks): Remove redundancy from condition.
(try_redirect_by_replacing_jump): Likewise.
(force_nonfallthru_and_redirect): Remove code for adding
UNLIKELY_EXECUTED_CODE notes to cold bb's.
(commit_one_edge_insertion): Likewise.
(cfg_layout_can_merge_blocks_p): Remove redundancy from condition.
* dbxout.c (FORCE_TEXT): Replace function_section with
current_function_section.
* except.c (output_function_esception_table): Likewise.
* final.c (profile_function): Likewise.
(scan_ahead_for_unlikely_executed_note): Remove function.
(final_scan_insn): Remove calls to scan_ahead_for_unlikely_executed_note,
and related code for switching to cold section, except for the
single time NOTE_INSN_UNLIKELY_EXECUTED_CODE may be encountered;
replace appropriate calls to function_section with calls to
current_function_section.
* ifcvt.c (find_if_case_1): Remove redundancy from condition.
(find_if_case_2): Likewise.
* opts.c (decode_options): Change warnings about hot/cold partitioning
options to informs (so as not to cause bootstrap failures).
* output.h (current_function_section): Add new function decl.
(insert_cold_section_boundary_note): Likewise.
* reg-stack.c (emit_swap_insn): Remove UNLIKELY_EXECUTED_CODE note insn
from consideration.
* varasm.c (basic-block.h): Add new include.
(initialize_cold_section_name): New function.
(last_text_section): New global variable.
(last_text_section_name): New global variable.
(text_section): Update last_text_section.
(unlikely_text_section): Replace code to determine cold section name with
call to initialize_cold_section_name; Add code to update
last_text_section.
(named_section_real): Update last_text_section and
last_text_section_name, if appropriate.
(function_sectin): Remove code that scans ahead for UNLIKELY_EXECUTED_CODE
notes.
(current_function_section): New function.
(assemble_start_function): Don't print out cold section name while
aligning it; set DECL_SECTION_NAME to cold section name if entire
function is cold; initialize last_text_section; add call to
insert_cold_section_boundary_note.
* config/x390/s390.c (s390_select_rtx_section): Replace function_section
with current_function_section.
* config/sparc/sparc.c (sparc_output_deferred_case_vectors): Likewise.
* config/stormy16/stormy16.c (stormy_16_output_addr_vec): Likewise.
* config/xtensa/xtensa.c (override_options): Turn off hot/cold
partitioning for this architecture.


Attachment: gcc5-hot-cold4.txt
Description: Text document



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]