llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Matt Arsenault (arsenm)

<details>
<summary>Changes</summary>

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) &lt;noreply@<!-- -->anthropic.com&gt;

---
Full diff: https://github.com/llvm/llvm-project/pull/224027.diff


2 Files Affected:

- (modified) clang/lib/Interpreter/DeviceOffload.cpp (-1) 
- (modified) clang/lib/Interpreter/Wasm.cpp (-1) 


``````````diff
diff --git a/clang/lib/Interpreter/DeviceOffload.cpp 
b/clang/lib/Interpreter/DeviceOffload.cpp
index 38cecd142a8e6..bf7653c518c30 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 e8dbffdff789c..a36a7f7b027e8 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");

``````````

</details>


https://github.com/llvm/llvm-project/pull/224027
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to