From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18095 invoked by alias); 13 May 2003 13:05:30 -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 18020 invoked from network); 13 May 2003 13:05:29 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 13 May 2003 13:05:29 -0000 Received: from localhost (tornado.toronto.redhat.com [172.16.14.228]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 1F969800030; Tue, 13 May 2003 09:05:28 -0400 (EDT) Subject: Re: [tree-ssa] Out of SSA status and issues From: Diego Novillo To: Andrew Macleod Cc: Michael Matz , gcc mailing list In-Reply-To: <1052830223.7945.83.camel@p4> References: <1052829751.27232.220.camel@frodo.toronto.redhat.com> <1052830223.7945.83.camel@p4> Content-Type: text/plain Organization: Red Hat Canada Message-Id: <1052831126.27232.241.camel@frodo.toronto.redhat.com> Mime-Version: 1.0 Date: Tue, 13 May 2003 13:05:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2003-05/txt/msg01293.txt.bz2 On Tue, 2003-05-13 at 08:50, Andrew MacLeod wrote: > On Tue, 2003-05-13 at 08:42, Diego Novillo wrote: > > On Tue, 2003-05-13 at 05:07, Michael Matz wrote: > > > > > An indirect reference is not a copy. I don't know if tree-ssa thinks it > > > is, but it definitely shouldn't. > > > > > 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'. It would > > probably not be efficient, but I can't see it being wrong. > > > > Not that tree-ssa will do anything with this code, the default > > type-based aliasing is too conservative, but PTA may disambiguate this. > > There is nothing wrong with it, as long as you know for sure that *p > hasn't changed between 'i = *p' and 'i+9'. Copyprop doesnt look for > that. All it does is says 'i = *p', I can replace all occurences of i > with *p... > Yes. After I finish the patch to proper rename INDIRECT_REFs, the code above should be rewritten into: 1. foo() 2. { 3. int i, *p; 4. 5. p_1 = malloc(); 6. i_2 = *(p_1)_3; 7. return i_2 + 9; 8. } Now I ask, suppose that we insert a new definition for 'p' in between lines 6 and 7: 1. foo() 2. { 3. int i, *p; 4. 5. p_1 = malloc(); 6. i_2 = *(p_1)_3; 7. p_4 = malloc(); 8. return i_2 + 9; 9. } Copyprop and DCE now convert this code into: 1. foo() 2. { 3. int *p; 4. 5. p_1 = malloc(); 6. p_4 = malloc(); 7. return *(p_1)_3 + 9; 8. } Will the coalescer DTRT here? Yes, it's a silly transformation, but I'm wondering if we don't have a bigger problem here. I've been toying with the idea of not bothering with renaming INDIRECT_REFs *at all*. We certainly get little benefit from it because they are often aliased and it really is somewhat painful to deal with them. Diego.