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]

Re: [patch] Fix PR middle-end/53590


On Wed, Jun 13, 2012 at 12:06 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> This PR is about straight-line code not being as much vectorized in Ada as in C
> or C++. ?The problem stems from the very conservative semantics implemented
> under -fnon-call-exceptions for the sake of Java. ?We don't need it in Ada.
>
> Tested on x86_64-suse-linux, OK for the mainline?

+@item -fdelete-dead-exceptions
+@opindex fdelete-dead-exceptions
+Assume that statements that may raise exceptions but don't otherwise contribute
+to the execution of the program can be optimized away.
+
+Most languages supporting exceptions disable this option at all levels.
+Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
+@option{-O2}, @option{-O3}, @option{-Os}.  Passes that use the information
+are enabled independently at different optimization levels.

I would not iterate all optimization levels here (you miss -Ofast), nor mention
them.  Thus, simply

+@item -fdelete-dead-exceptions
+@opindex fdelete-dead-exceptions
+Assume that statements that may raise exceptions but don't otherwise contribute
+to the execution of the program can be optimized away.
+
This flag is set by the frontends according to their language specification.
Passes that cause dead exceptions to be removed are enabled
independently at different optimization levels.

and be done with that.  Btw, what is "doesn't otherwise contribute to
the execution"?
That is, is the Ada equivalent of

 try { a / maybe_zero; } catch (...) { printf ("maybe_zero was zero!"); }

dead code?

Btw, I suppose you need to arrange to properly transfer the flag for LTO
in some way (well, or conservatively not remove dead exceptions at link-time).

Thanks,
Richard.

>
> 2012-06-13 ?Eric Botcazou ?<ebotcazou@adacore.com>
>
> ? ? ? ?PR middle-end/53590
> ? ? ? ?* common.opt (-fdelete-dead-exceptions): New switch.
> ? ? ? ?* doc/invoke.texi (Optimization Options): Document it.
> ? ? ? ?* cse.c (insn_live_p): Do not return true for an insn that could throw
> ? ? ? ?if dead exceptions can be deleted.
> ? ? ? ?* 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): Do not preserve an insn that could throw if dead
> ? ? ? ?exceptions can be deleted.
> ? ? ? ?* 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


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