diff options
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r-- | gcc/cfgcleanup.c | 119 |
1 files changed, 82 insertions, 37 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 99e0baa756e..6836a9e6e84 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1137,7 +1137,7 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx i1, rtx i2) /* For address sanitizer, never crossjump __asan_report_* builtins, otherwise errors might be reported on incorrect lines. */ - if (flag_asan) + if (flag_sanitize & SANITIZE_ADDRESS) { rtx call = get_call_rtx_from (i1); if (call && GET_CODE (XEXP (XEXP (call, 0), 0)) == SYMBOL_REF) @@ -2807,10 +2807,21 @@ try_optimize_cfg (int mode) df_analyze (); } -#ifdef ENABLE_CHECKING if (changed) - verify_flow_info (); + { + /* Edge forwarding in particular can cause hot blocks previously + reached by both hot and cold blocks to become dominated only + by cold blocks. This will cause the verification below to fail, + and lead to now cold code in the hot section. This is not easy + to detect and fix during edge forwarding, and in some cases + is only visible after newly unreachable blocks are deleted, + which will be done in fixup_partitions. */ + fixup_partitions (); + +#ifdef ENABLE_CHECKING + verify_flow_info (); #endif + } changed_overall |= changed; first_pass = false; @@ -3040,25 +3051,42 @@ execute_jump (void) return 0; } -struct rtl_opt_pass pass_jump = +namespace { + +const pass_data pass_data_jump = { - { - RTL_PASS, - "jump", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - NULL, /* gate */ - execute_jump, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_JUMP, /* tv_id */ - 0, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - TODO_verify_rtl_sharing, /* todo_flags_finish */ - } + RTL_PASS, /* type */ + "jump", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + false, /* has_gate */ + true, /* has_execute */ + TV_JUMP, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_verify_rtl_sharing, /* todo_flags_finish */ }; + +class pass_jump : public rtl_opt_pass +{ +public: + pass_jump(gcc::context *ctxt) + : rtl_opt_pass(pass_data_jump, ctxt) + {} + + /* opt_pass methods: */ + unsigned int execute () { return execute_jump (); } + +}; // class pass_jump + +} // anon namespace + +rtl_opt_pass * +make_pass_jump (gcc::context *ctxt) +{ + return new pass_jump (ctxt); +} static unsigned int execute_jump2 (void) @@ -3067,22 +3095,39 @@ execute_jump2 (void) return 0; } -struct rtl_opt_pass pass_jump2 = +namespace { + +const pass_data pass_data_jump2 = { - { - RTL_PASS, - "jump2", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - NULL, /* gate */ - execute_jump2, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_JUMP, /* tv_id */ - 0, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - TODO_verify_rtl_sharing, /* todo_flags_finish */ - } + RTL_PASS, /* type */ + "jump2", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + false, /* has_gate */ + true, /* has_execute */ + TV_JUMP, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_verify_rtl_sharing, /* todo_flags_finish */ }; + +class pass_jump2 : public rtl_opt_pass +{ +public: + pass_jump2(gcc::context *ctxt) + : rtl_opt_pass(pass_data_jump2, ctxt) + {} + + /* opt_pass methods: */ + unsigned int execute () { return execute_jump2 (); } + +}; // class pass_jump2 + +} // anon namespace + +rtl_opt_pass * +make_pass_jump2 (gcc::context *ctxt) +{ + return new pass_jump2 (ctxt); +} |