[Bug middle-end/60092] posix_memalign not recognized to derive alias and alignment info
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 6 11:34:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60092
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
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).
More information about the Gcc-bugs
mailing list