Skip to content

Commit

Permalink
[MemCpy] Add comments for r279769
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D23846

llvm-svn: 279778
  • Loading branch information
timshen91 committed Aug 25, 2016
1 parent 6ac9172 commit 3ad8b43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions llvm/test/Transforms/MemCpyOpt/pr29105.ll
@@ -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 {
Expand Down

0 comments on commit 3ad8b43

Please sign in to comment.