> 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?
Can't I have sometihng like loop (i as iterator) begin I := F(0); exception when E => N := N + 1; end; 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? Honza