[MemCpy] Add comments for r279769
authorTim Shen <timshen91@gmail.com>
Thu, 25 Aug 2016 21:03:46 +0000 (21:03 +0000)
committerTim Shen <timshen91@gmail.com>
Thu, 25 Aug 2016 21:03:46 +0000 (21:03 +0000)
Differential Revision: https://reviews.llvm.org/D23846

llvm-svn: 279778

llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
llvm/test/Transforms/MemCpyOpt/pr29105.ll

index 27c37cd..c6e8cde 100644 (file)
@@ -1110,7 +1110,8 @@ bool MemCpyOptPass::performMemCpyToMemSetOptzn(MemCpyInst *MemCpy,
                                                MemSetInst *MemSet) {
   AliasAnalysis &AA = LookupAliasAnalysis();
 
-  // This only makes sense on memcpy(..., memset(...), ...).
+  // Make sure that memcpy(..., memset(...), ...), that is we are memsetting and
+  // memcpying from the same address. Otherwise it is hard to reason about.
   if (!AA.isMustAlias(MemSet->getRawDest(), MemCpy->getRawSource()))
     return false;
 
index ad9f97e..0d37783 100644 (file)
@@ -1,6 +1,7 @@
 ; RUN: opt -memcpyopt -instcombine -S %s | FileCheck %s
 %Foo = type { [2048 x i64] }
 
+; Make sure that all mempcy calls are converted to memset calls, or removed.
 ; CHECK-LABEL: @baz(
 ; CHECK-NOT: call void @llvm.memcpy
 define void @baz() unnamed_addr #0 {