================ @@ -1850,25 +1870,22 @@ CallInst *CodeExtractor::emitReplacerCall( if (StructValues.contains(output)) continue; - AllocaInst *alloca = new AllocaInst( - output->getType(), DL.getAllocaAddrSpace(), nullptr, - output->getName() + ".loc", AllocaBlock->getFirstInsertionPt()); - params.push_back(alloca); - ReloadOutputs.push_back(alloca); + Value *OutAlloc = + allocateVar(AllocaBlock, AllocaBlock->getFirstInsertionPt(), + output->getType(), output->getName() + ".loc"); + params.push_back(OutAlloc); + ReloadOutputs.push_back(OutAlloc); } - AllocaInst *Struct = nullptr; + Instruction *Struct = nullptr; if (!StructValues.empty()) { - Struct = new AllocaInst(StructArgTy, DL.getAllocaAddrSpace(), nullptr, - "structArg", AllocaBlock->getFirstInsertionPt()); - if (ArgsInZeroAddressSpace && DL.getAllocaAddrSpace() != 0) { - auto *StructSpaceCast = new AddrSpaceCastInst( - Struct, PointerType ::get(Context, 0), "structArg.ascast"); - StructSpaceCast->insertAfter(Struct->getIterator()); + AddrSpaceCastInst *StructSpaceCast = nullptr; + Struct = allocateVar(AllocaBlock, AllocaBlock->getFirstInsertionPt(), + StructArgTy, "structArg", &StructSpaceCast); + if (StructSpaceCast) params.push_back(StructSpaceCast); - } else { + else ---------------- Meinersbur wrote:
My mistake: your patch also removes braces on the if part. https://github.com/llvm/llvm-project/pull/150925 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits