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

Jameson Nash via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 15:01:08 PDT 2025


================
@@ -18,13 +18,13 @@ define void @test(ptr %src, i8 %c, i64 %size) {
   ret void
 }
 
-; Differing sizes, so left as it is.
+; Differing sizes, but would be UB if size1 > size2
----------------
vtjnash wrote:

Oops, I meant size1 < size2 (since the memcpy accesses size2 bytes from both allocas). If size1 > size2, the bytes are undef, but not UB.

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


More information about the llvm-commits mailing list