[mlir] Let ModuleTranslate propagate LLVM triple

This adds LLVM triple propagation and updates the test that did not check it properly.

Differential Revision: https://reviews.llvm.org/D92182
This commit is contained in:
Nicolas Vasilache
2020-11-26 15:58:34 +00:00
parent a513be4900
commit 5dd5a08363
2 changed files with 4 additions and 0 deletions

View File

@@ -946,6 +946,9 @@ std::unique_ptr<llvm::Module> ModuleTranslation::prepareLLVMModule(
if (auto dataLayoutAttr =
m->getAttr(LLVM::LLVMDialect::getDataLayoutAttrName()))
llvmModule->setDataLayout(dataLayoutAttr.cast<StringAttr>().getValue());
if (auto targetTripleAttr =
m->getAttr(LLVM::LLVMDialect::getTargetTripleAttrName()))
llvmModule->setTargetTriple(targetTripleAttr.cast<StringAttr>().getValue());
// Inject declarations for `malloc` and `free` functions that can be used in
// memref allocation/deallocation coming from standard ops lowering.

View File

@@ -1319,6 +1319,7 @@ module attributes {llvm.target_triple = "x86_64-pc-windows-msvc"} {}
// -----
// CHECK-NOT: "CodeView", i32 1
// CHECK: aarch64-linux-android
module attributes {llvm.target_triple = "aarch64-linux-android"} {}
// -----