From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29374 invoked by alias); 9 Jul 2019 13:28:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 29279 invoked by uid 89); 9 Jul 2019 13:28:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 Jul 2019 13:28:08 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9AB75AFAB; Tue, 9 Jul 2019 13:28:06 +0000 (UTC) Date: Tue, 09 Jul 2019 13:30:00 -0000 From: Richard Biener To: Jan Hubicka cc: gcc-patches@gcc.gnu.org, d@dcepelik.cz Subject: Re: Make nonoverlapping_component_refs work with duplicated main variants In-Reply-To: <20190709130724.5lnqywgf7xxmlny4@kam.mff.cuni.cz> Message-ID: References: <20190708072649.vqd5u6jxsz5ybtt7@kam.mff.cuni.cz> <20190709114917.qva4nb2h7j5vzdur@kam.mff.cuni.cz> <20190709123124.rdelfgb5gkdebdr4@kam.mff.cuni.cz> <20190709130724.5lnqywgf7xxmlny4@kam.mff.cuni.cz> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="-1609908220-1805281689-1562678886=:2976" X-SW-Source: 2019-07/txt/msg00703.txt.bz2 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1609908220-1805281689-1562678886=:2976 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT Content-length: 2463 On Tue, 9 Jul 2019, Jan Hubicka wrote: > > > tree_int_cst_equal will return false if offsets are not INTEGER_CST. > > > I was not sure if I can safely use operand_equal_p. What happens for > > > fields with variable offsets when I inline two copies of same function > > > which takes size as parameter and make the size different? Will I get > > > here proper SSA name so operand_equal_p will work? > > > > No, you get a DECL, but yes, I think operand_equal_p will work. > > Consider two _same_ variable sizes, you'll not see that you > > have to return zero then? But yes, in case you have types > > globbed to the canonical type (but not FIELD_DECLs) then > > you'll get false !operand_equal_p as well. > > > > The question is really what is desired here. If you want/need precision > > for non-constant offsets then you have to look at the COMPONENT_REF > > trees because the relevant offset (SSA name) is only there > > (in TREE_OPERAND (component_ref, 2)). > > > > If you want to give up for non-constants and can do that without > > correctness issue then fine (but Ada probably would like to have > > it - so also never forget to include Ada in testing here ;)) > > I would like to have precision here. so perhaps as incremental change I > can > 1) reorganize callers to pass refs rather than just field_decls > 2) check if TREE_OPERAND (component_ref, 2) is non-NULL in both case > a) if so do operand_equal_p on them and return 0 on match > b) if there is no match see if I have same canonical types and > return 1 then > c) return -1 otherwise makes sense > 3) continue with parsing FIELD_DECLS we work on now. > > > > Oh, OK ... a bit more explaining commentary might be nice > > (at the top of the function - basically what the input > > constraints to the FIELD_DECLs are). > > OK, will try to improve comments (though i tried to be relatively > thorough). > > Honza > > > > Btw, the offsets in FIELD_DECLs are relative to DECL_CONTEXT so > > comparing when DECL_CONTEXT are not related at all doesn't make > > any sense. Well, unless we know _those_ are at the same offset, > > so - the constraint for the FIELD_DECLs we compare is that > > the containing structure type object instances live at the same > > address? > > > > Richard. > -- Richard Biener SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer, Mary Higgins, Sri Rasiah; HRB 21284 (AG Nürnberg) ---1609908220-1805281689-1562678886=:2976--