[PATCH] D71499: Add builtins for aligning and checking alignment of pointers and integers
Alexander Richardson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 2 05:37:54 PST 2020
arichardson added a comment.
In D71499#1801104 <https://reviews.llvm.org/D71499#1801104>, @lebedev.ri wrote:
> Looks ok to me now in principle.
> I have one more question about pointer variants though (see inline)
I am not sure the GEP can be inbounds since I have seen some cases where aligning pointers is used to get a pointer to a different object.
I most cases it should be in-bounds (even when used to implement `malloc()`), but I have seen some cases where aligning pointers is used to get a pointer to a different object.
For example, some versions WebKit align pointers down by 64k to get a pointer to a structure that holds metadata for all objects allocated inside that region.
I am not sure what happens for those cases if we add inbounds (miscompilation?), so I haven't added it here.
I guess we could add it if alignment is a constant and is less than the object size, but there might already be a pass to infer if a GEP is inbounds?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71499/new/
https://reviews.llvm.org/D71499
More information about the cfe-commits
mailing list