[llvm] Inline: Fix handling of byval using non-alloca addrspace (PR #97306)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 16 10:13:48 PDT 2024
================
@@ -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(),
----------------
arsenm wrote:
No, this is the correct fix. We should follow what the existing IR says. The rule is not all allocas must have the alloca address space, it's the alloca address space is the default for contextless new values.
As far as OpenCL is concerned such IR would have been malformed in the first place. If we wanted to handle this as a generic pointer with a private backed alloca, it should be handled by lowering the alloca with the wrong address space to include the cast (which is essentially what NVPTX does, it's just more work for the backend and less optimizable IR)
https://github.com/llvm/llvm-project/pull/97306
More information about the llvm-commits
mailing list