[clang] clang-sycl-linker: Compute the DataLayout from the triple (PR #224376)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 05:29:23 PDT 2026


https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/224376

>From 4a32dd7d722f7fba9b6e89c13c332cd544154c42 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Thu, 17 Sep 2026 18:55:32 +0200
Subject: [PATCH] clang-sycl-linker: Compute the DataLayout from the triple

Seed the module's DataLayout from the target triple directly rather than from
TargetMachine::createDataLayout().

Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
---
 clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp b/clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp
index 70afc6d6c4cea..0f05de29f5118 100644
--- a/clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp
+++ b/clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp
@@ -652,7 +652,7 @@ static Error runCodeGen(StringRef File, const llvm::Triple &TargetTriple,
 
   // Set data layout if needed.
   if (M->getDataLayout().isDefault())
-    M->setDataLayout(TM->createDataLayout());
+    M->setDataLayout(TargetTriple.computeDataLayout());
 
   // Open output file for writing.
   int FD = -1;



More information about the cfe-commits mailing list