From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16495 invoked by alias); 6 Feb 2014 11:34:57 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 16458 invoked by uid 48); 6 Feb 2014 11:34:53 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/60092] posix_memalign not recognized to derive alias and alignment info Date: Thu, 06 Feb 2014 11:34:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: alias, missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg00574.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60092 --- Comment #3 from Richard Biener --- Created attachment 32064 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32064&action=edit part #1, aliasing I've implemented the aliasing parts (and the builtin obviously). It's true that doing posix_memalign (&ptr, ....); ptr = __builtin_assume_aligned (ptr, ...); will keep ptr address-taken - but isn't it kept address-taken anyway because it's passed to posix_memalign? I think you are mixing the possible optimization we can do to posix_memalign in general with the alignment issue, no? Thus, we could transform posix_memalign (&ptr, ....); to void *tem; posix_memalign (&tem, ....); ptr = tem; independently. Doing it as part of the alignment stuff of course makes sense. But as you say, eventually we'd just use an extra stack slot for no good reason. I've long thought of teaching some more tricks to update_address_taken - basically ignore some of the address-takens and apply simple transforms on the stmts causing them if that would make the var non-address-taken (memcpy comes to my mind as well here).