Skip to content

Commit a32941a

Browse files
committed
cleanup
1 parent ec254a3 commit a32941a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,8 +1367,8 @@ bool MemCpyOptPass::processMemSetMemCpyDependence(MemCpyInst *MemCpy,
13671367
return true;
13681368
}
13691369

1370-
/// Determine whether the pointer V had only undefined content from Def up to
1371-
/// the given Size, either because it was freshly alloca'd or started its
1370+
/// Determine whether the pointer V had only undefined content (due to Def) up
1371+
/// to the given Size, either because it was freshly alloca'd or started its
13721372
/// lifetime.
13731373
static bool hasUndefContents(MemorySSA *MSSA, BatchAAResults &AA, Value *V,
13741374
MemoryDef *Def, Value *Size) {
@@ -1404,8 +1404,8 @@ static bool hasUndefContents(MemorySSA *MSSA, BatchAAResults &AA, Value *V,
14041404
return false;
14051405
}
14061406

1407-
static bool coversInputFully(MemorySSA *MSSA, MemCpyInst *MemCpy,
1408-
MemIntrinsic *MemSrc, BatchAAResults &BAA) {
1407+
static bool inputFullyCoveredBySrc(MemorySSA *MSSA, MemCpyInst *MemCpy,
1408+
MemIntrinsic *MemSrc, BatchAAResults &BAA) {
14091409
// If the memcpy is larger than the previous, but the memory was undef prior
14101410
// to that, we can just ignore the tail. Technically we're only
14111411
// interested in the bytes from 0..MemSrcOffset and
@@ -1452,7 +1452,6 @@ bool MemCpyOptPass::performMemCpyToMemSetOptzn(MemCpyInst *MemCpy,
14521452
MOffset = *Offset;
14531453
}
14541454

1455-
MaybeAlign MDestAlign = MemCpy->getDestAlign();
14561455
if (MOffset != 0 || MemSetSize != CopySize) {
14571456
// Make sure the memcpy doesn't read any more than what the memset wrote,
14581457
// other than undef. Don't worry about sizes larger than i64. A known memset
@@ -1466,7 +1465,7 @@ bool MemCpyOptPass::performMemCpyToMemSetOptzn(MemCpyInst *MemCpy,
14661465
if (!CCopySize)
14671466
return false;
14681467
if (CCopySize->getZExtValue() + MOffset > CMemSetSize->getZExtValue()) {
1469-
if (!coversInputFully(MSSA, MemCpy, MemSet, BAA))
1468+
if (!inputFullyCoveredBySrc(MSSA, MemCpy, MemSet, BAA))
14701469
return false;
14711470
// Clip the memcpy to the bounds of the memset
14721471
if (MOffset == 0)

llvm/test/Transforms/MemCpyOpt/memset-memcpy-to-2x-memset.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ define void @test_different_source_gep(ptr %dst1, ptr %dst2, i8 %c) {
7777
; CHECK-NEXT: ret void
7878
;
7979
call void @llvm.memset.p0.i64(ptr %dst1, i8 %c, i64 128, i1 false)
80-
; FIXME: We could optimize this as well.
8180
%p = getelementptr i8, ptr %dst1, i64 64
8281
call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %p, i64 64, i1 false)
8382
ret void

0 commit comments

Comments
 (0)