[llvm-dev] Alignment parameter attributes

Doerfert, Johannes via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 14 12:57:10 PST 2020


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>


More information about the llvm-dev mailing list