summaryrefslogtreecommitdiff
path: root/mlir/lib/Target
diff options
context:
space:
mode:
authorMehdi Amini <joker.eph@gmail.com>2020-08-19 00:32:30 +0000
committerMehdi Amini <joker.eph@gmail.com>2020-08-19 01:19:03 +0000
commite75bc5c791e0e8dbe79f7453e55af9e8d03c9cc0 (patch)
tree0c12504777cba0473a1b0d657a6502900c782cd9 /mlir/lib/Target
parentc996d49c6987b78bceab55cf36f236c7de066b31 (diff)
downloadllvm-e75bc5c791e0e8dbe79f7453e55af9e8d03c9cc0.tar.gz
Revert "Separate the Registration from Loading dialects in the Context"
This reverts commit d14cf45735b0d09d7d3caf0824779520dd20ef10. The build is broken with GCC-5.
Diffstat (limited to 'mlir/lib/Target')
-rw-r--r--mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp1
-rw-r--r--mlir/lib/Target/LLVMIR/ModuleTranslation.cpp5
2 files changed, 3 insertions, 3 deletions
diff --git a/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp b/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
index a5d833893879..470044bc9953 100644
--- a/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
+++ b/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
@@ -836,7 +836,6 @@ LogicalResult Importer::processBasicBlock(llvm::BasicBlock *bb, Block *block) {
OwningModuleRef
mlir::translateLLVMIRToModule(std::unique_ptr<llvm::Module> llvmModule,
MLIRContext *context) {
- context->loadDialect<LLVMDialect>();
OwningModuleRef module(ModuleOp::create(
FileLineColLoc::get("", /*line=*/0, /*column=*/0, context)));
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 21f5201c7d69..f8277d154f27 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -302,7 +302,8 @@ ModuleTranslation::ModuleTranslation(Operation *module,
: mlirModule(module), llvmModule(std::move(llvmModule)),
debugTranslation(
std::make_unique<DebugTranslation>(module, *this->llvmModule)),
- ompDialect(module->getContext()->getOrLoadDialect<omp::OpenMPDialect>()),
+ ompDialect(
+ module->getContext()->getRegisteredDialect<omp::OpenMPDialect>()),
typeTranslator(this->llvmModule->getContext()) {
assert(satisfiesLLVMModule(mlirModule) &&
"mlirModule should honor LLVM's module semantics.");
@@ -943,8 +944,8 @@ ModuleTranslation::lookupValues(ValueRange values) {
std::unique_ptr<llvm::Module> ModuleTranslation::prepareLLVMModule(
Operation *m, llvm::LLVMContext &llvmContext, StringRef name) {
- m->getContext()->getOrLoadDialect<LLVM::LLVMDialect>();
auto llvmModule = std::make_unique<llvm::Module>(name, llvmContext);
+
if (auto dataLayoutAttr =
m->getAttr(LLVM::LLVMDialect::getDataLayoutAttrName()))
llvmModule->setDataLayout(dataLayoutAttr.cast<StringAttr>().getValue());