================ @@ -3382,6 +3422,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) { ---------------- nikic wrote:
I think this check isn't entirely right, in case we can't see through to the underlying object (e.g. a very long gep chain). In that case even though we're writing to the alloca, we'd leave a memset here. I think it would be more robust if isAllocSiteRemovable returned the ModRefInfo and then you made the decision here on whether this is a Mod or Ref alloca. https://github.com/llvm/llvm-project/pull/143958 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits