diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2024-07-01 21:09:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-01 21:09:41 +0200 |
commit | e47359a925b88cd081ea85d10b55b0625d17b212 (patch) | |
tree | 3b8b6d47eb535b89bd8e03f03d69576bc7253546 /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | 95e823e88982127666eec76e79143f2857daa2ad (diff) | |
download | llvm-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.cpp | 5 |
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); |