From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1523 invoked by alias); 13 May 2003 12:57:19 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 1383 invoked from network); 13 May 2003 12:57:18 -0000 Received: from unknown (HELO Cantor.suse.de) (213.95.15.193) by sources.redhat.com with SMTP; 13 May 2003 12:57:18 -0000 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id 12B4615225; Tue, 13 May 2003 14:56:44 +0200 (MEST) Date: Tue, 13 May 2003 12:57:00 -0000 From: Michael Matz To: Diego Novillo Cc: Andrew Macleod , gcc mailing list Subject: Re: [tree-ssa] Out of SSA status and issues In-Reply-To: <1052829751.27232.220.camel@frodo.toronto.redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2003-05/txt/msg01289.txt.bz2 Hi, On 13 May 2003, Diego Novillo wrote: > Why? > > 1. foo() > 2. { > 3. int i, *p; > 4. > 5. p = malloc(); > 6. i = *p; > 7. return i + 9; > 8. } > > I see nothing wrong in replacing 'i + 9' with '*p + 9'. I do. *p could have been changed in between 6 and 7. The useful thing of SSA is, that there is exactly one definition of an entity, and that is the reason that you can copy-propagate extremely easily (because you know, that the source of the copy can't be possibly changed after that copy insn, because the def must have reached it, and that was the only def). To be able to propagate *p you have to explicitely proove by some means that it still is unchanged at the places of the uses of the copied-into entity. This would be exactly detrimental to the usefullness of copy propagation. I.e. *p is not a register but an expression, and a copy instruction copies registers to registers. > Not that tree-ssa will do anything with this code, the default > type-based aliasing is too conservative, but PTA may disambiguate this. Of course you _can_ optimize such cases, but it's not a subset of copy propagation but, hmm, un-PRE or something like that. Ciao, Michael.