[mlir] Add support for LLVM's dso_local attr
authorFelipe de Azevedo Piovezan <felipe@cerebras.net>
Tue, 29 Jun 2021 12:57:16 +0000 (14:57 +0200)
committerAlex Zinenko <zinenko@google.com>
Tue, 29 Jun 2021 13:00:48 +0000 (15:00 +0200)
commit8ca04b05133b9fc1b891585e9dfd6e30790998ba
tree8e65d1df12fe2b38de6f1f940148a1e1848a20e2
parent355216380b9c11e5d7a16ac20619cf16b1c0151c
[mlir] Add support for LLVM's dso_local attr

This patch brings support for setting runtime preemption specifiers of
LLVM's GlobalValues. In LLVM semantics, if the `dso_local` attribute
is not explicitly requested, then it is inferred based on linkage and
visibility. We model this same behavior with a UnitAttribute: if it is
present, then we explicitly request the GlobalValue to marked as
`dso_local`, otherwise we rely on the GlobalValue itself to make this
decision.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D104983
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/test/Target/LLVMIR/llvmir.mlir