[PATCH] D76333: [MLIR] Allow global with external linkage to include an initial value

Eric Schweitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 18 15:14:08 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG7b5d4669daa4: [MLIR] Allow global with an external linkage to include initial value (authored by schweitz).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76333/new/

https://reviews.llvm.org/D76333

Files:
  mlir/lib/Target/LLVMIR/ModuleTranslation.cpp


Index: mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
===================================================================
--- mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -470,7 +470,8 @@
 
     auto linkage = convertLinkageToLLVM(op.linkage());
     bool anyExternalLinkage =
-        (linkage == llvm::GlobalVariable::ExternalLinkage ||
+        ((linkage == llvm::GlobalVariable::ExternalLinkage &&
+          isa<llvm::UndefValue>(cst)) ||
          linkage == llvm::GlobalVariable::ExternalWeakLinkage);
     auto addrSpace = op.addr_space().getLimitedValue();
     auto *var = new llvm::GlobalVariable(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76333.251188.patch
Type: text/x-patch
Size: 659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200318/0cc589b9/attachment.bin>


More information about the llvm-commits mailing list