On 05/19/14 02:58, Eric Botcazou wrote:
Hi,

this fixes an over-optimization of the GIMPLE optimizer, whereby two otherwise
identical calls to a pure function present in different EH regions are CSEd,
which changes the semantics of the program because the second EH handler is
not invoked:

   begin
     I := F(0);
   exception
     when E => N := N + 1;
   end;

   begin
     I := F(0);
   exception
     when E => N := N +1;
   end;

Two passes (DOM and FRE) can optimize this construct and a test modelled on
stmt_can_throw_internal is used to coax them into not doing so.

Tested on x86_64-suse-linux, OK for the mainline?


2014-05-19  Eric Botcazou  <ebotca...@adacore.com>

        * tree-ssa-dom.c (hashable_expr_equal_p) <EXPR_CALL>: Also compare the
        EH region of calls to pure functions that can throw an exception.
        * tree-ssa-sccvn.c (vn_reference_eq): Remove redundant test.
        (copy_reference_ops_from_call): Also copy the EH region of the call if
        it can throw an exception.
DOM bits are good. Richi wants the "redundant" test to be kept around, so OK with that change.


Jeff

Reply via email to