[llvm] Inline: Fix handling of byval using non-alloca addrspace (PR #97306)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 08:15:12 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(),
-                                         nullptr, Alignment, Arg->getName());
+  AllocaInst *NewAlloca = new AllocaInst(
+      ByValType, cast<PointerType>(Arg->getType())->getAddressSpace(), nullptr,
----------------
nikic wrote:

```suggestion
      ByValType, Arg->getType()->getPointerAddressSpace(), nullptr,
```

https://github.com/llvm/llvm-project/pull/97306


More information about the llvm-commits mailing list