Skip to content

Commit 92ba8f2

Browse files
committed
Simplify per review feedback
1 parent af2703e commit 92ba8f2

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ bool MemCpyOptPass::processMemCpyMemCpyDependence(MemCpyInst *M,
12121212
// Don't convert llvm.memcpy.inline into memmove because memmove can be
12131213
// lowered as a call, and that is not allowed for llvm.memcpy.inline (and
12141214
// there is no inline version of llvm.memmove)
1215-
if (auto *MCI = dyn_cast<MemCpyInst>(M); MCI && MCI->isForceInlined())
1215+
if (M->isForceInlined())
12161216
return false;
12171217
UseMemMove = true;
12181218
}
@@ -1229,19 +1229,17 @@ bool MemCpyOptPass::processMemCpyMemCpyDependence(MemCpyInst *M,
12291229
NewM =
12301230
Builder.CreateMemMove(M->getDest(), M->getDestAlign(), CopySource,
12311231
CopySourceAlign, M->getLength(), M->isVolatile());
1232-
else if (auto *MCI = dyn_cast<MemCpyInst>(M)) {
1233-
if (MCI->isForceInlined())
1234-
// llvm.memcpy may be promoted to llvm.memcpy.inline, but the converse is
1235-
// never allowed since that would allow the latter to be lowered as a call
1236-
// to an external function.
1237-
NewM = Builder.CreateMemCpyInline(M->getDest(), M->getDestAlign(),
1238-
CopySource, CopySourceAlign,
1239-
M->getLength(), M->isVolatile());
1240-
else
1241-
NewM = Builder.CreateMemCpy(M->getDest(), M->getDestAlign(), CopySource,
1242-
CopySourceAlign, M->getLength(),
1243-
M->isVolatile());
1244-
}
1232+
else if (M->isForceInlined())
1233+
// llvm.memcpy may be promoted to llvm.memcpy.inline, but the converse is
1234+
// never allowed since that would allow the latter to be lowered as a call
1235+
// to an external function.
1236+
NewM = Builder.CreateMemCpyInline(M->getDest(), M->getDestAlign(),
1237+
CopySource, CopySourceAlign,
1238+
M->getLength(), M->isVolatile());
1239+
else
1240+
NewM = Builder.CreateMemCpy(M->getDest(), M->getDestAlign(), CopySource,
1241+
CopySourceAlign, M->getLength(),
1242+
M->isVolatile());
12451243

12461244
NewM->copyMetadata(*M, LLVMContext::MD_DIAssignID);
12471245

0 commit comments

Comments
 (0)