[llvm] SPIRV: Avoid TargetMachine::createDataLayout in SPIRVTranslate (PR #224017)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 06:50:11 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-spir-v

Author: Matt Arsenault (arsenm)

<details>
<summary>Changes</summary>

When the input module has no DataLayout string, compute the fallback from the
target triple directly rather than from TargetMachine::createDataLayout(), which
will eventually be removed.

This is hardcoding the assumption that target-abi is empty. In principle this should
read that from the module.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@<!-- -->anthropic.com>

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


1 Files Affected:

- (modified) llvm/lib/Target/SPIRV/SPIRVAPI.cpp (+1-2) 


``````````diff
diff --git a/llvm/lib/Target/SPIRV/SPIRVAPI.cpp b/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
index e4d30349d6e7b..17def333a065f 100644
--- a/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
@@ -103,8 +103,7 @@ SPIRVTranslate(Module *M, std::string &SpirvObj, std::string &ErrMsg,
 
   std::string DLStr = M->getDataLayoutStr();
   Expected<DataLayout> MaybeDL = DataLayout::parse(
-      DLStr.empty() ? Target->createDataLayout().getStringRepresentation()
-                    : DLStr);
+      DLStr.empty() ? TargetTriple.computeDataLayout() : DLStr);
   if (!MaybeDL) {
     ErrMsg = toString(MaybeDL.takeError());
     return false;

``````````

</details>


https://github.com/llvm/llvm-project/pull/224017


More information about the llvm-commits mailing list