[llvm] [Attributor] Pack out arguments into a struct (PR #119267)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 4 09:57:44 PST 2025
elhewaty wrote:
@vidsinghal @arsenm,
What trying to do here, is creating a new variables instead of old argument args using allocas.
```
BasicBlock *EntryBlock = BasicBlock::Create(NewFunction->getContext(), "entry", NewFunction);
IRBuilder<> EntryBuilder(EntryBlock);
for (auto &OldArg : F.args()) {
if (PtrToType.count(&OldArg)) {
// The crash happens here, any hint?
AllocaInst *Alloca = EntryBuilder.CreateAlloca(
PtrToType[&OldArg], nullptr, OldArg.getName());
EntryBuilder.CreateStore(&OldArg, Alloca);
VMap[&OldArg] = Alloca;
} else
VMap[&OldArg] = &(*NewArgIt++);
}
```
https://github.com/llvm/llvm-project/pull/119267
More information about the llvm-commits
mailing list