https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/224027
The incremental CUDA device and Wasm executors reset the module's DataLayout from TargetMachine::createDataLayout() before codegen. These modules are produced by clang's own CodeGen, so already have a datalayout so this is redundant. This also avoids using the TargetMachine copy of the datalayout, which will eventually be removed. Co-authored-by: Claude (Claude-Opus-4.8) <[email protected]> >From b93de74ef5201189bbf871ddc2c32b87a0b70227 Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Wed, 16 Sep 2026 15:59:03 +0200 Subject: [PATCH] [clang][Interpreter] Do not overwrite the module's DataLayout The incremental CUDA device and Wasm executors reset the module's DataLayout from TargetMachine::createDataLayout() before codegen. These modules are produced by clang's own CodeGen, so already have a datalayout so this is redundant. This also avoids using the TargetMachine copy of the datalayout, which will eventually be removed. Co-authored-by: Claude (Claude-Opus-4.8) <[email protected]> --- clang/lib/Interpreter/DeviceOffload.cpp | 1 - clang/lib/Interpreter/Wasm.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/clang/lib/Interpreter/DeviceOffload.cpp b/clang/lib/Interpreter/DeviceOffload.cpp index 38cecd142a8e6b..bf7653c518c309 100644 --- a/clang/lib/Interpreter/DeviceOffload.cpp +++ b/clang/lib/Interpreter/DeviceOffload.cpp @@ -56,7 +56,6 @@ llvm::Expected<llvm::StringRef> IncrementalCUDADeviceParser::GeneratePTX() { llvm::TargetMachine *TargetMachine = Target->createTargetMachine( PTU.TheModule->getTargetTriple(), TargetOpts.CPU, "", TO, llvm::Reloc::Model::PIC_); - PTU.TheModule->setDataLayout(TargetMachine->createDataLayout()); PTXCode.clear(); llvm::raw_svector_ostream dest(PTXCode); diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp index e8dbffdff789c7..a36a7f7b027e8b 100644 --- a/clang/lib/Interpreter/Wasm.cpp +++ b/clang/lib/Interpreter/Wasm.cpp @@ -89,7 +89,6 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) { llvm::TargetOptions TO = llvm::TargetOptions(); llvm::TargetMachine *TargetMachine = Target->createTargetMachine( PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_); - PTU.TheModule->setDataLayout(TargetMachine->createDataLayout()); llvm::SmallString<256> ObjectFileName(TempDir); llvm::sys::path::append(ObjectFileName, PTU.TheModule->getName() + ".o"); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
