[llvm] SPIRV: Avoid TargetMachine::createDataLayout in SPIRVTranslate (PR #224017)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 16 06:49:31 PDT 2026
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/224017
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 at anthropic.com>
>From 059994f21442647eb68dc580ec74d08ee527c867 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 16 Sep 2026 15:47:21 +0200
Subject: [PATCH] SPIRV: Avoid TargetMachine::createDataLayout in
SPIRVTranslate
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 at anthropic.com>
---
llvm/lib/Target/SPIRV/SPIRVAPI.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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;
More information about the llvm-commits
mailing list