-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alignment on malloc instruction is not codegened correctly #1734
Comments
This test (align.ll) should output all 0s if the align is being respected. It #include <stdlib.h> int main(int argc, char** argv) { changing the memalign call into a malloc 1, align 256, which should have the |
true. The problem is that not all targets support memalign, e.g. darwin. |
*** Bug llvm/llvm-bugzilla-archive#1531 has been marked as a duplicate of this bug. *** |
There are a few ways to fix the issue:
|
Neither of these are abi compatible with GCC. this would prevent you from compiling one .c file with llvm -Chris |
Because posix_memalign is not available on all platforms. |
The real fix for this is to just remove the mallocinst instruction. |
*** This bug has been marked as a duplicate of bug #1087 *** |
mentioned in issue #1087 |
Extended Description
the backends (including C and x86) do not respect alignment on malloc. consider
test/Features/alignment.ll. The final malloc (%T) should be codegened to a
memalign to preserve the alignment.
Once this is done, all memalign and posix_memalign calls can be safely
transformed into llvm malloc instructions. Plus it is just broken right now.
The text was updated successfully, but these errors were encountered: