From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94891 invoked by alias); 6 Nov 2015 10:25:38 -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 94849 invoked by uid 89); 6 Nov 2015 10:25:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 06 Nov 2015 10:25:32 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id B14752A7CE8F; Fri, 6 Nov 2015 11:25:29 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 45us2PYFvXbz; Fri, 6 Nov 2015 11:25:29 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id BA0612A7CE6B; Fri, 6 Nov 2015 11:25:28 +0100 (CET) From: Eric Botcazou To: Alan Lawrence Cc: gcc-patches@gcc.gnu.org, Richard Biener Subject: Re: [PATCH 6/6] Make SRA replace constant-pool loads Date: Fri, 06 Nov 2015 10:25:00 -0000 Message-ID: <3140627.MeDMMqneAH@polaris> User-Agent: KMail/4.14.9 (Linux/3.16.7-29-desktop; KDE/4.14.9; x86_64; ; ) In-Reply-To: References: <1446146302-17002-1-git-send-email-alan.lawrence@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2015-11/txt/msg00576.txt.bz2 > Hmm, can you clarify, do you mean I should *not* replace constant pool > values with their DECL_INITIAL? The attempt to substitute in the > initial value is what leads to most of the problems. For example, in > gnat/opt31.adb, create_access finds this expression accessing *.LC0: > > MEM[(interfaces__unsigned_8[(sizetype) opt31__messages_t___XUP>.P_BOUNDS->LB0: opt31__messages_t___XUP>.P_BOUNDS->UB0 >= opt31__messages_t___XUP>.P_BOUNDS->LB0 ? (sizetype) struct opt31__messages_t___XUP>.P_BOUNDS->UB0 : (sizetype) > .P_BOUNDS->LB0 + > 4294967295] *)&*.LC0][1 ...]{lb: 1 sz: 1} > > this is an ARRAY_RANGE_REF of a MEM_REF of an ADDR_EXPR of *.LC0. So > far I haven't extended subst_constant_pool_initial to handle > ARRAY_RANGE_REFs, as it can't even handle this MEM_REF: > > MEM[(interfaces__unsigned_8[(sizetype) opt31__messages_t___XUP>.P_BOUNDS->LB0: opt31__messages_t___XUP>.P_BOUNDS->UB0 >= opt31__messages_t___XUP>.P_BOUNDS->LB0 ? (sizetype) struct opt31__messages_t___XUP>.P_BOUNDS->UB0 : (sizetype) > .P_BOUNDS->LB0 + > 4294967295] *)&*.LC0] > > because the type here has size: > > MIN_EXPR <_GLOBAL.SZ2.ada_opt31 ( opt31__messages_t___XUP>.P_BOUNDS->UB0, opt31__messages_t___XUP>.P_BOUNDS->LB0), 17179869176> > > inside the MEM_REF of the ADDR_EXPR is *.LC0, whose DECL_INITIAL is a > 4-element array (fine). Sadly while the MEM_REF > type_contains_placeholder_p, the type of the outer ARRAY_RANGE_REF > does not.... FWIW you are allowed to punt on this kind of complex expressions that appear only in Ada. New optimizations are sort of allowed to work on the C family of languages first, and be extended or not to the rest of languages afterwards. > One possibility is that this whole construct, ARRAY_RANGE_REF that it > is, should mark *.LC0 in cannot_scalarize_away_bitmap. ARRAY_RANGE_REF is only used in Ada so you can do that for now (unless this introduces regressions in the gnat.dg testsuite but I doubt it). -- Eric Botcazou