This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Fix over-optimization of calls to pure function
- From: Jeff Law <law at redhat dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 19 May 2014 11:01:47 -0600
- Subject: Re: [patch] Fix over-optimization of calls to pure function
- Authentication-results: sourceware.org; auth=none
- References: <5409358 dot 5kA2CkRFhr at polaris>
On 05/19/14 02:58, Eric Botcazou wrote:
DOM bits are good. Richi wants the "redundant" test to be kept around,
so OK with that change.
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
I := F(0);
when E => N := N + 1;
I := F(0);
when E => N := N +1;
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 <email@example.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.