[llvm] WebAssembly: Avoid using createDataLayout (PR #223836)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 14:48:07 PDT 2026
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/223836
>From 67b5701b46970fe93fb038e1fedbf893cebfc811 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Tue, 15 Sep 2026 23:11:19 +0200
Subject: [PATCH] WebAssembly: Avoid using createDataLayout
Find the datalayout from the IR context instead of copying one
from the TargetMachine
---
.../Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
index f916a38f898dc..07c3c2c9f4fbe 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
@@ -18,6 +18,7 @@
#include "WebAssemblySubtarget.h"
#include "WebAssemblyUtilities.h"
#include "llvm/CodeGen/Analysis.h"
+#include "llvm/IR/Module.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
@@ -66,7 +67,8 @@ void llvm::computeSignatureVTs(const FunctionType *Ty,
SmallVectorImpl<MVT> &Results) {
computeLegalValueVTs(ContextFunc, TM, Ty->getReturnType(), Results);
- MVT PtrVT = MVT::getIntegerVT(TM.createDataLayout().getPointerSizeInBits());
+ const DataLayout &DL = ContextFunc.getParent()->getDataLayout();
+ MVT PtrVT = MVT::getIntegerVT(DL.getPointerSizeInBits());
if (!WebAssembly::canLowerReturn(
Results.size(),
&TM.getSubtarget<WebAssemblySubtarget>(ContextFunc))) {
@@ -90,7 +92,7 @@ void llvm::computeSignatureVTs(const FunctionType *Ty,
if (TargetFunc && (TargetFunc->getCallingConv() == CallingConv::Swift ||
TargetFunc->getCallingConv() == CallingConv::SwiftTail)) {
- MVT PtrVT = MVT::getIntegerVT(TM.createDataLayout().getPointerSizeInBits());
+ MVT PtrVT = MVT::getIntegerVT(DL.getPointerSizeInBits());
bool HasSwiftErrorArg = false;
bool HasSwiftSelfArg = false;
bool HasSwiftAsyncArg = false;
More information about the llvm-commits
mailing list