[Mlir-commits] [mlir] 9d92bea - [MLIR][LLVMIR] Fix use-after-move

Nikita Popov llvmlistbot at llvm.org
Thu Feb 13 01:46:09 PST 2025


Author: Nikita Popov
Date: 2025-02-13T10:46:01+01:00
New Revision: 9d92bea507be19f4a3dba6107aa5eeb6e95a2765

URL: https://github.com/llvm/llvm-project/commit/9d92bea507be19f4a3dba6107aa5eeb6e95a2765
DIFF: https://github.com/llvm/llvm-project/commit/9d92bea507be19f4a3dba6107aa5eeb6e95a2765.diff

LOG: [MLIR][LLVMIR] Fix use-after-move

Fix an issue introduced in #126929: The LLVM module is moved into
the ModuleTranslator, so query the DataLayout from there.

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 300907b548e3d..5cd841ee2df91 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -2143,7 +2143,8 @@ mlir::translateModuleToLLVMIR(Operation *module, llvm::LLVMContext &llvmContext,
 
   ModuleTranslation translator(module, std::move(llvmModule));
   llvm::IRBuilder<llvm::TargetFolder> llvmBuilder(
-      llvmContext, llvm::TargetFolder(llvmModule->getDataLayout()));
+      llvmContext,
+      llvm::TargetFolder(translator.getLLVMModule()->getDataLayout()));
 
   // Convert module before functions and operations inside, so dialect
   // attributes can be used to change dialect-specific global configurations via


        


More information about the Mlir-commits mailing list