From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56370 invoked by alias); 9 Jul 2019 13:07:29 -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 56315 invoked by uid 89); 9 Jul 2019 13:07:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1 spammy= X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 Jul 2019 13:07:26 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 4D37528083E; Tue, 9 Jul 2019 15:07:24 +0200 (CEST) Date: Tue, 09 Jul 2019 13:10:00 -0000 From: Jan Hubicka To: Richard Biener Cc: gcc-patches@gcc.gnu.org, d@dcepelik.cz Subject: Re: Make nonoverlapping_component_refs work with duplicated main variants Message-ID: <20190709130724.5lnqywgf7xxmlny4@kam.mff.cuni.cz> References: <20190708072649.vqd5u6jxsz5ybtt7@kam.mff.cuni.cz> <20190709114917.qva4nb2h7j5vzdur@kam.mff.cuni.cz> <20190709123124.rdelfgb5gkdebdr4@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-SW-Source: 2019-07/txt/msg00699.txt.bz2 > > 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 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.