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: PR tree-opt/19484: noreturn vs. function pointer propagation


Richard Henderson <rth@redhat.com> writes:
> On Sat, Jan 22, 2005 at 10:08:48AM +0000, Richard Sandiford wrote:
>> 	(cleanup_control_flow): Remove fallthru edges from calls that are
>> 	now known not to return.
>
> We want similar cleanup for ECF_NOTHROW.

Isn't that already done by tree_purge_dead_eh_edges?  E.g. DOM has:

      /* If we simplified a statement in such a way as to be shown that it
         cannot trap, update the eh information and the cfg to match.  */
      if (maybe_clean_eh_stmt (stmt))
        {
          bitmap_set_bit (need_eh_cleanup, bb->index);
          if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "  Flagged to clear EH edges.\n");
        }

and later:

      /* Removal of statements may make some EH edges dead.  Purge
         such edges from the CFG as needed.  */
      if (!bitmap_empty_p (need_eh_cleanup))
        {
          cfg_altered |= tree_purge_all_dead_eh_edges (need_eh_cleanup);
          bitmap_zero (need_eh_cleanup);
        }

I tried a simple testcase like:

      extern void foo (void) __attribute__((nothrow));
      int n;

      void
      g (void)
      {
        try
          {
            void (*f) (void) = foo;
            if (n)
              f ();
            n = 1;
          }
        catch (...)
          {
            n = 2;
          }
      }

The EH edge was removed after DOM (and the catch was therefore
deleted as dead).

Richard


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