[NVPTX] Add initial support for '.alias' in PTX
authorJoseph Huber <jhuber6@vols.utk.edu>
Wed, 12 Jul 2023 18:35:01 +0000 (13:35 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 21 Jul 2023 21:43:46 +0000 (16:43 -0500)
commitf4381d46445709fda9b8ec6c8f85d019de2dad22
tree8c27dc704b7aa13942ab395af14b221cf71e8879
parent28eec1bd85d2a0eb342fbad8fb2cace389e772d5
[NVPTX] Add initial support for '.alias' in PTX

This patch adds initial support for using aliases when targeting PTX. We
perform a pretty strict conversion from the globals referenced to the
expected output. as described in the PTX documentation at
https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#kernel-and-function-directives-alias

These cannot currently be used due to a bug in the `nvlink`
implementation that causes aliases to pruned functions to crash the
linker.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D155211
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h
llvm/test/CodeGen/NVPTX/alias-errors.ll [new file with mode: 0644]
llvm/test/CodeGen/NVPTX/alias.ll