aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2024-07-01 21:09:41 +0200
committerGitHub <noreply@github.com>2024-07-01 21:09:41 +0200
commite47359a925b88cd081ea85d10b55b0625d17b212 (patch)
tree3b8b6d47eb535b89bd8e03f03d69576bc7253546 /llvm/lib/Transforms/Utils/InlineFunction.cpp
parent95e823e88982127666eec76e79143f2857daa2ad (diff)
downloadllvm-e47359a925b88cd081ea85d10b55b0625d17b212.zip
llvm-e47359a925b88cd081ea85d10b55b0625d17b212.tar.gz
llvm-e47359a925b88cd081ea85d10b55b0625d17b212.tar.bz2
Inline: Fix handling of byval using non-alloca addrspace (#97306)
Use the address space of the original pointer argument instead of querying the datalayout. This avoids producing a verifier error since this was changing the address space for the user instructions. Fixes #97086
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 0725add..036527c 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1674,8 +1674,9 @@ static Value *HandleByValArgument(Type *ByValType, Value *Arg,
if (ByValAlignment)
Alignment = std::max(Alignment, *ByValAlignment);
- AllocaInst *NewAlloca = new AllocaInst(ByValType, DL.getAllocaAddrSpace(),
- nullptr, Alignment, Arg->getName());
+ AllocaInst *NewAlloca =
+ new AllocaInst(ByValType, Arg->getType()->getPointerAddressSpace(),
+ nullptr, Alignment, Arg->getName());
NewAlloca->insertBefore(Caller->begin()->begin());
IFI.StaticAllocas.push_back(NewAlloca);