From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15939 invoked by alias); 12 Feb 2014 10:18:26 -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 15892 invoked by uid 48); 12 Feb 2014 10:18:22 -0000 From: "jakub 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: Wed, 12 Feb 2014 10:18: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: jakub 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: 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/msg01131.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60092 --- Comment #19 from Jakub Jelinek --- (In reply to Tobias Burnus from comment #18) > (In reply to Richard Biener from comment #1) > > We could "lower" > > posix_memalign (&ptr, align, size); > > to > > posix_memalign (&ptr, align, size); > > ptr = __builtin_assume_algined (ptr, align); > > and hope for FRE to fix things up enough to make that useful. > > > I wonder about mm_malloc. I assume for config/i386/pmm_malloc.h, it is > already handled via posix_memalign, but shouldn't one also handle > config/i386/gmm_malloc.h? For instance via > > --- a/gcc/config/i386/gmm_malloc.h > +++ b/gcc/config/i386/gmm_malloc.h > @@ -61,7 +61,11 @@ _mm_malloc (size_t size, size_t align) > /* Store the original pointer just before p. */ > ((void **) aligned_ptr) [-1] = malloc_ptr; > > +#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 7 > + return __builtin_assume_aligned(aligned_ptr, align); > +#else > return aligned_ptr; > +#endif > } > > static __inline__ void No, why? ccp of course understands the dynamic realignment: aligned_ptr = (void *) (((size_t) malloc_ptr + align) & ~((size_t) (align) - 1)); so will know that aligned_ptr is align bytes aligned.