[Mlir-commits] [mlir] 7b5d466 - [MLIR] Allow global with an external linkage to include initial value

Eric Schweitz llvmlistbot at llvm.org
Wed Mar 18 14:50:17 PDT 2020


Author: Eric Schweitz
Date: 2020-03-18T14:46:54-07:00
New Revision: 7b5d4669daa465d92058bad33860bce26f2c8c20

URL: https://github.com/llvm/llvm-project/commit/7b5d4669daa465d92058bad33860bce26f2c8c20
DIFF: https://github.com/llvm/llvm-project/commit/7b5d4669daa465d92058bad33860bce26f2c8c20.diff

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

Reviewers: rriddle, ftynse

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D76333

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 2c3a68fa1081..dfb4f58472e1 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -470,7 +470,8 @@ LogicalResult ModuleTranslation::convertGlobals() {
 
     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(


        


More information about the Mlir-commits mailing list