[Mlir-commits] [mlir] 5dd5a08 - [mlir] Let ModuleTranslate propagate LLVM triple

Nicolas Vasilache llvmlistbot at llvm.org
Fri Nov 27 00:05:29 PST 2020


Author: Nicolas Vasilache
Date: 2020-11-27T08:01:44Z
New Revision: 5dd5a083630c797c958b02acd381b9de2bf02c86

URL: https://github.com/llvm/llvm-project/commit/5dd5a083630c797c958b02acd381b9de2bf02c86
DIFF: https://github.com/llvm/llvm-project/commit/5dd5a083630c797c958b02acd381b9de2bf02c86.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index d333c2ff8390..4f21eac5965f 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -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.

diff  --git a/mlir/test/Target/llvmir.mlir b/mlir/test/Target/llvmir.mlir
index 8491e67fdfb5..9dc2fbfda028 100644
--- a/mlir/test/Target/llvmir.mlir
+++ b/mlir/test/Target/llvmir.mlir
@@ -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"} {}
 
 // -----


        


More information about the Mlir-commits mailing list