[Bug c/79518] __builtin_assume_aligned should mark argument as aligned
evan@coeus-group.com
gcc-bugzilla@gcc.gnu.org
Wed Feb 15 19:09:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79518
--- Comment #4 from Evan Nemerson <evan@coeus-group.com> ---
I agree that GCC's implementation makes more sense, but unfortunately it makes
it hard to write portable code.
I'm not suggesting the current behavior be abandoned, only that
__builtin_assume_aligned be enhanced so the argument is marked as aligned when
possible.
Think of it as an optimization opportunity; given something like
void* foo = __builtin_assume_aligned(bar, 16);
/* Use bar for something instead of foo */
GCC could see that bar is 16-byte aligned and generate better code accordingly,
even though the programmer did something dumb.
I won't reopen this, but I hope you will… AFAICT there aren't any
disadvantages, and it would be very helpful for people with code already
optimized using MSVC, ICC, etc.
More information about the Gcc-bugs
mailing list