Skip to content

Commit 289b44d

Browse files
committed
Fix nits
1 parent d5a966c commit 289b44d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ bool MemCpyOptPass::processMemCpyMemCpyDependence(MemCpyInst *M,
11511151

11521152
// The length of the memcpy's must be the same, or the preceding one
11531153
// must be larger than the following one.
1154-
if (MForwardOffset != 0 || (MDep->getLength() != M->getLength())) {
1154+
if (MForwardOffset != 0 || MDep->getLength() != M->getLength()) {
11551155
auto *MDepLen = dyn_cast<ConstantInt>(MDep->getLength());
11561156
auto *MLen = dyn_cast<ConstantInt>(M->getLength());
11571157
if (!MDepLen || !MLen ||
@@ -1175,12 +1175,11 @@ bool MemCpyOptPass::processMemCpyMemCpyDependence(MemCpyInst *M,
11751175
// The copy destination of `M` maybe can serve as the source of copying.
11761176
std::optional<int64_t> MDestOffset =
11771177
M->getRawDest()->getPointerOffsetFrom(MDep->getRawSource(), DL);
1178-
if (MDestOffset && *MDestOffset == MForwardOffset)
1178+
if (MDestOffset == MForwardOffset)
11791179
CopySource = M->getRawDest();
11801180
else
11811181
CopySource = Builder.CreateInBoundsPtrAdd(
1182-
CopySource, ConstantInt::get(Type::getInt64Ty(Builder.getContext()),
1183-
MForwardOffset));
1182+
CopySource, Builder.getInt64(MForwardOffset));
11841183
MCopyLoc = MCopyLoc.getWithNewPtr(CopySource);
11851184
if (CopySourceAlign)
11861185
CopySourceAlign = commonAlignment(*CopySourceAlign, MForwardOffset);

0 commit comments

Comments
 (0)