[MLIR] Correct linkage of lowered globalop
authorWilliam S. Moses <gh@wsmoses.com>
Tue, 17 Aug 2021 22:22:04 +0000 (18:22 -0400)
committerWilliam S. Moses <gh@wsmoses.com>
Wed, 18 Aug 2021 15:09:43 +0000 (11:09 -0400)
commit8c2ff7b69e77a9eccf4a13bcc21dee5894b251af
treefe3b37ba5cea6e06117d6dbe55742b1294cc4d91
parent7151a8aada21c2f961f9d984a0e9c77ae6f3da08
[MLIR] Correct linkage of lowered globalop

LLVM considers global variables marked as externals to be defined within the module if it is initialized (including to an undef). Other external globals are considered as being defined externally and imported into the current translation unit. Lowering of MLIR Global Ops does not properly propagate undefined initializers, resulting in a global which is expected to be defined within the current TU, not being defined.

Differential Revision: https://reviews.llvm.org/D108252
mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir