From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95945 invoked by alias); 16 Nov 2015 14:08:40 -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 95936 invoked by uid 89); 16 Nov 2015 14:08:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Nov 2015 14:08:33 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-13-S_O4la87QY-srjqn1jw9Nw-1; Mon, 16 Nov 2015 14:08:28 +0000 Received: from [10.2.206.221] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 16 Nov 2015 14:08:27 +0000 Subject: Re: [PATCH][GCC] Make stackalign test LTO proof To: Richard Biener References: <5644AB37.3050201@arm.com> <5649C158.50903@arm.com> Cc: GCC Patches From: Andre Vieira Message-ID: <5649E35B.608@arm.com> Date: Mon, 16 Nov 2015 14:08:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: X-MC-Unique: S_O4la87QY-srjqn1jw9Nw-1 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg01954.txt.bz2 On 16/11/15 13:33, Richard Biener wrote: > On Mon, Nov 16, 2015 at 12:43 PM, Andre Vieira > wrote: >> On 13/11/15 10:34, Richard Biener wrote: >>> >>> On Thu, Nov 12, 2015 at 4:07 PM, Andre Vieira >>> wrote: >>>> >>>> Hi, >>>> >>>> This patch changes this testcase to make sure LTO will not optimize >>>> away >>>> the assignment of the local array to a global variable which was >>>> introduced >>>> to make sure stack space was made available for the test to work. >>>> >>>> This is correct because LTO is supposed to optimize this global aw= ay >>>> as at >>>> link time it knows this global will never be read. By adding a read of >>>> the >>>> global, LTO will no longer optimize it away. >>> >>> >>> But that's only because we can't see that bar doesn't clobber it, else >>> we would optimize away the check and get here again. Much better >>> to mark 'dummy' with __attribute__((used)) and go away with 'g' entirel= y. >>> >>> Richard. >>> >>>> Tested by running regressions for this testcase for various ARM >>>> targets. >>>> >>>> Is this OK to commit? >>>> >>>> Thanks, >>>> Andre Vieira >>>> >>>> gcc/testsuite/ChangeLog: >>>> 2015-11-06 Andre Vieira >>>> >>>> * gcc.dg/torture/stackalign/builtin-return-1.c: Added read >>>> to global such that a write is not optimized away by LTO. >>> >>> >> Hi Richard, >> >> That would be great but __attribute__ ((used)) can only be used for stat= ic >> variables and making dummy static would defeat the purpose here. > > I see. What about volatile? > >> Cheers, >> Andre >> > Yeh a 'volatile char dummy[64];' with a read afterwards leads to the=20 stack still being reserved after LTO and we won't need the global variable. If you prefer that solution Ill respin the patch. Cheers, Andre