================
@@ -3382,6 +3418,17 @@ Instruction
*InstCombinerImpl::visitAllocSite(Instruction &MI) {
eraseInstFromFunction(*I);
Users[i] = nullptr; // Skip examining in the next loop.
}
+ if (auto *MTI = dyn_cast<MemTransferInst>(I)) {
+ if (KnowInitZero && getUnderlyingObject(MTI->getRawDest()) != &MI) {
+ IRBuilderBase::InsertPointGuard Guard(Builder);
+ Builder.SetInsertPoint(MTI);
+ auto *M = Builder.CreateMemSet(MTI->getRawDest(),
+ ConstantInt::get(Type::getInt8Ty(MI.getContext()), 0),
+ MTI->getLength(),
+ MTI->getDestAlign());
+ M->copyMetadata(*MTI, LLVMContext::MD_DIAssignID);
----------------
nikic wrote:
Should probably copy all the metadata? E.g. to preserve AA metadata.
https://github.com/llvm/llvm-project/pull/143958
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits