This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Non-call exceptions versus cse
- From: Michael Matz <matz at suse dot de>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: <aph at redhat dot com>, <gcc-patches at gcc dot gnu dot org>, <rth at redhat dot com>
- Date: Tue, 26 Nov 2002 11:24:04 +0100 (CET)
- Subject: Re: Non-call exceptions versus cse
Hi,
On Mon, 25 Nov 2002, Richard Kenner wrote:
> int tmp = <may trap operation>;
> var = tmp;
>
> should not update var if the operation traps.
>
> That's expensive to guarantee.
I don't think so. If you reread the thread I already wrote why combining
the above two insns is not safe in the general case and why I think CSE
shouldn't anyway do this currently. But obviously CSE does do that, and
I'm more or less puzzled how that was supposed to work. At least the
transformations CSE is doing that Andrew posted (the before and after CSE
dumps of the RTL stream) are quite bogus. It moved an assignment of a
pseudo into a basic block, were it wasn't before, ergo there are now more
codepaths in which that pseudo is set, in particular one codepath in which
it before CSE retained it's old value, but after CSE overwrote that value.
That's never a safe transformation without more checks of the validity
(independent from the reason for basic block borders, trapping insns or
simple jumps).
I don't know if such invalid transformations only happen with exceptions
involved, but I can't see the underlying machinery in CSE to prevent that.
Ciao,
Michael.