On Fri, Jun 15, 2012 at 11:13 AM, Eric Botcazou <ebotca...@adacore.com> wrote: >> If we don't do it, we'll get another PR saying "this works in LTO mode with >> other versions of the Ada compiler" (which is true) so I'll proceed. > > Here is what I've installed after bootstrapping/regtesting on > x86_64-suse-linux > and i586-suse-linux. It adds the flag to 'struct function' and streams it.
Btw, I think we should enable this flag by default for all languages but Java so that if you enable -fnon-call-exceptions for C or C++ you don't get too many spurious exceptions from dead code. Thanks, Richard. > While I was at it, I also changed the trivially-dead-insns machinery in cse.c > and dse.c to use the same predicate as dce.c, namely !insn_nothrow_p instead > of insn_could_throw_p. The former is more precise and well suited to these > optimization passes. cfgexpand.c and reload1.c keep using the latter when > they are massaging the RTL stream. > > > PR middle-end/53590 > * common.opt (-fdelete-dead-exceptions): New switch. > * doc/invoke.texi (Code Gen Options): Document it. > * cse.c (count_reg_usage) <CALL_INSN>: Use !insn_nothrow_p in lieu of > insn_could_throw_p predicate. Do not skip an insn that could throw > if dead exceptions can be deleted. > (insn_live_p): Likewise, do not return true in that case. > * dce.c (can_alter_cfg): New flag. > (deletable_insn_p): Do not return false for an insn that can throw if > the CFG can be altered and dead exceptions can be deleted. > (init_dce): Set can_alter_cfg to false for fast DCE, true otherwise. > * dse.c (scan_insn): Use !insn_nothrow_p in lieu of insn_could_throw_ > predicate. Do not preserve an insn that could throw if dead exceptions > can be deleted. > * function.h (struct function): Add can_delete_dead_exceptions flag. > * function.c (allocate_struct_function): Set it. > * lto-streamer-in.c (input_struct_function_base): Stream it. > * lto-streamer-out.c (input_struct_function_base): Likewise. > * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Do not mark a > statement that could throw as necessary if dead exceptions can be > deleted. > ada/ > * gcc-interface/misc.c (gnat_init_options_struct): Set > opts->x_flag_delete_dead_exceptions to 1. > > > -- > Eric Botcazou