[llvm] [memcpyopt] handle memcpy from memset in more cases (PR #140954)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 09:06:12 PDT 2025


================
@@ -1403,6 +1404,24 @@ static bool hasUndefContents(MemorySSA *MSSA, BatchAAResults &AA, Value *V,
   return false;
 }
 
+static bool coversInputFully(MemorySSA *MSSA, MemCpyInst *MemCpy,
+                             MemIntrinsic *MemSrc, BatchAAResults &BAA) {
----------------
nikic wrote:

I don't really get what followup change you have in mind, but if you think canReduceSize is inaccurate, then maybe something along the lines of overreadIsUndef?

I don't think the new name inputFullyCoveredBySrc is really better than the old, because this function is specifically detecting the case where the input is *not* fully covered by src (it is partially covered by src and partially by undef initialization)...

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


More information about the llvm-commits mailing list