[PATCH] D117921: Attributes: add a new allocalign attribute
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 3 08:56:03 PST 2022
reames requested changes to this revision.
reames added a comment.
This revision now requires changes to proceed.
This patch looks mechanically fine, we just need to get the LangRef wording finalized.
I did have a thought when reading over this. Is there anything specific here to an allocation function? Could we generalize this into a generic "retalign" parameter attribute which generalizes align(N) on the return value and allows non-constant alignments to be described?
I'm not sure that generalization is actually useful, it just seems like we have something which is almost non-allocation specific. If we could think of examples where non-constant alignments are useful, then it seems a shame to leave it specialized...
================
Comment at: llvm/docs/LangRef.rst:1383
+``allocalign``
+ The function parameter marked with this attribute is is the alignment in bytes of the
+ newly allocated block returned by this function. That is, it's similar to putting
----------------
I can't make heads or tails of the current wording. I'd suggest something along the lines of:
This attribute indicates that the alignment of the newly allocated object returned by this allocation function can be assumed to be greater than the runtime value of the marked parameter.
That is, it's similar to putting`align(N)` on the return value of the function but allows the alignment to be a runtime value.
Runtime alignment values which aren't a power of 2 are undefined behavior.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117921/new/
https://reviews.llvm.org/D117921
More information about the llvm-commits
mailing list