Loading mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td +3 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ def LLVM_Dialect : Dialect { /// Uses `reportError` to report errors. static LogicalResult verifyDataLayoutString( StringRef descr, llvm::function_ref<void (const Twine &)> reportError); /// Name of the target triple attribute. static StringRef getTargetTripleAttrName() { return "llvm.target_triple"; } }]; } Loading mlir/lib/Target/LLVMIR/DebugTranslation.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,17 @@ DebugTranslation::DebugTranslation(Operation *module, llvm::Module &llvmModule) if (!llvmModule.getModuleFlag(debugVersionKey)) llvmModule.addModuleFlag(llvm::Module::Warning, debugVersionKey, llvm::DEBUG_METADATA_VERSION); if (auto targetTripleAttr = module->getAttr(LLVM::LLVMDialect::getTargetTripleAttrName())) { auto targetTriple = llvm::Triple(targetTripleAttr.cast<StringAttr>().getValue()); if (targetTriple.isKnownWindowsMSVCEnvironment()) { // Dwarf debugging files will be generated by default, unless "CodeView" // is set explicitly. Windows/MSVC should use CodeView instead. llvmModule.addModuleFlag(llvm::Module::Warning, "CodeView", 1); } } } /// Finalize the translation of debug information. Loading mlir/test/Target/llvmir.mlir +14 −0 Original line number Diff line number Diff line Loading @@ -1311,3 +1311,17 @@ module attributes {llvm.data_layout = "E"} { llvm.func @module_big_endian() } // ----- // CHECK: "CodeView", i32 1 module attributes {llvm.target_triple = "x86_64-pc-windows-msvc"} {} // ----- // CHECK-NOT: "CodeView", i32 1 module attributes {llvm.target_triple = "aarch64-linux-android"} {} // ----- // CHECK-NOT: "CodeView", i32 1 module attributes {} {} Loading
mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td +3 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ def LLVM_Dialect : Dialect { /// Uses `reportError` to report errors. static LogicalResult verifyDataLayoutString( StringRef descr, llvm::function_ref<void (const Twine &)> reportError); /// Name of the target triple attribute. static StringRef getTargetTripleAttrName() { return "llvm.target_triple"; } }]; } Loading
mlir/lib/Target/LLVMIR/DebugTranslation.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,17 @@ DebugTranslation::DebugTranslation(Operation *module, llvm::Module &llvmModule) if (!llvmModule.getModuleFlag(debugVersionKey)) llvmModule.addModuleFlag(llvm::Module::Warning, debugVersionKey, llvm::DEBUG_METADATA_VERSION); if (auto targetTripleAttr = module->getAttr(LLVM::LLVMDialect::getTargetTripleAttrName())) { auto targetTriple = llvm::Triple(targetTripleAttr.cast<StringAttr>().getValue()); if (targetTriple.isKnownWindowsMSVCEnvironment()) { // Dwarf debugging files will be generated by default, unless "CodeView" // is set explicitly. Windows/MSVC should use CodeView instead. llvmModule.addModuleFlag(llvm::Module::Warning, "CodeView", 1); } } } /// Finalize the translation of debug information. Loading
mlir/test/Target/llvmir.mlir +14 −0 Original line number Diff line number Diff line Loading @@ -1311,3 +1311,17 @@ module attributes {llvm.data_layout = "E"} { llvm.func @module_big_endian() } // ----- // CHECK: "CodeView", i32 1 module attributes {llvm.target_triple = "x86_64-pc-windows-msvc"} {} // ----- // CHECK-NOT: "CodeView", i32 1 module attributes {llvm.target_triple = "aarch64-linux-android"} {} // ----- // CHECK-NOT: "CodeView", i32 1 module attributes {} {}