[Bug middle-end/60092] posix_memalign not recognized to derive alias and alignment info
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 12 10:18:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60092
--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(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.
More information about the Gcc-bugs
mailing list