[NVPTX] Use the mask() operator to initialize packed structs with pointers
authorIgor Kudrin <ikudrin@accesssoftek.com>
Mon, 18 Jul 2022 11:03:55 +0000 (04:03 -0700)
committerIgor Kudrin <ikudrin@accesssoftek.com>
Mon, 18 Jul 2022 11:08:59 +0000 (04:08 -0700)
commit04e978ccba1e6c8b600b2fbad1a82b4b64ffc34b
tree58767379eff7ff79270d4c3a1098986cb52e657b
parente27f9214c0465fab2d5efa3cf462019836f5eb08
[NVPTX] Use the mask() operator to initialize packed structs with pointers

The current implementation assumes that all pointers used in the
initialization of an aggregate are aligned according to the pointer size
of the target; that might not be so if the object is packed. In that
case, an array of .u8 should be used and pointers should be decorated
with the mask() operator.

The operator was introduced in PTX ISA 7.1, so an error is issued if the
case is detected for an earlier version.

Differential Revision: https://reviews.llvm.org/D127504
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h
llvm/lib/Target/NVPTX/NVPTXSubtarget.h
llvm/test/CodeGen/NVPTX/packed-aggr.ll [new file with mode: 0644]