Skip to content

Commit 2c53676

Browse files
nikicsivan-shani
authored andcommitted
[MLIR][LLVMIR] Fix use-after-move
Fix an issue introduced in llvm#126929: The LLVM module is moved into the ModuleTranslator, so query the DataLayout from there.
1 parent 4c6df99 commit 2c53676

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,8 @@ mlir::translateModuleToLLVMIR(Operation *module, llvm::LLVMContext &llvmContext,
21432143

21442144
ModuleTranslation translator(module, std::move(llvmModule));
21452145
llvm::IRBuilder<llvm::TargetFolder> llvmBuilder(
2146-
llvmContext, llvm::TargetFolder(llvmModule->getDataLayout()));
2146+
llvmContext,
2147+
llvm::TargetFolder(translator.getLLVMModule()->getDataLayout()));
21472148

21482149
// Convert module before functions and operations inside, so dialect
21492150
// attributes can be used to change dialect-specific global configurations via

0 commit comments

Comments
 (0)