This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Fix over-optimization of calls to pure function
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 19 May 2014 16:42:28 +0200
- Subject: Re: [patch] Fix over-optimization of calls to pure function
- Authentication-results: sourceware.org; auth=none
- References: <5409358 dot 5kA2CkRFhr at polaris>
> 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:
> 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?
Can't I have sometihng like
loop (i as iterator)
I := F(0);
when E => N := N + 1;
here I would expect PRE to discover I as loop invariant that will cause
exception to be called just once, not at every iteration of loop?
Can't the same happen for non-call expcetions?