Greene, David via llvm-dev
2020-Jan-14 18:01 UTC
[llvm-dev] Alignment parameter attributes
I have a question about how to communicate alignment via function parameters. The IR supports an attribute specifying the alignment of a pointer parameter: define void @func(double* noalias align 64 %p) This says that %p is 64-byte aligned. Great! Is there any way to convey the alignment of a pointer pointed to by a ** argument? I'd like something like this: define void @func(double* align 64 * noalias %p) Or even this to add a noalias attribute: define void @func(double* noalias align 64 * noalias %p) I don't think either of these is legal today. Has anyone else run into this need? If so, any advice would be much appreciated! -David
Doerfert, Johannes via llvm-dev
2020-Jan-14 20:57 UTC
[llvm-dev] Alignment parameter attributes
On 01/14, Greene, David via llvm-dev wrote:> I have a question about how to communicate alignment via function > parameters. The IR supports an attribute specifying the alignment of a > pointer parameter: > > define void @func(double* noalias align 64 %p) > > This says that %p is 64-byte aligned. Great! > > Is there any way to convey the alignment of a pointer pointed to by a ** > argument? I'd like something like this: > > define void @func(double* align 64 * noalias %p) > > Or even this to add a noalias attribute: > > define void @func(double* noalias align 64 * noalias %p) > > I don't think either of these is legal today. > > Has anyone else run into this need? If so, any advice would be much > appreciated!If you have this knowledge during code generation you can associate align metadata to the loads from %p. We could use a custom tag on `llvm.assume`, as an extension of https://reviews.llvm.org/D72475, but that is not yet implemented. Cheers, Johannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 228 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200114/e1d918f3/attachment.sig>
Greene, David via llvm-dev
2020-Jan-14 22:23 UTC
[llvm-dev] Alignment parameter attributes
"Doerfert, Johannes via llvm-dev" <llvm-dev at lists.llvm.org> writes:> We could use a custom tag on `llvm.assume`, as an extension of > https://reviews.llvm.org/D72475, but that is not yet implemented.I had thought about using llvm.assume but was wondering if there is a better way. Tagging the loads with metadata really seems about the same amount of effort. Both require major surgery to code generation. Thanks for your help Johannes! -David