[llvm] [MemCpyOpt] Always create gep instructions in `processMemCpyMemCpyDependence` (PR #98686)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 12:39:08 PDT 2024
================
@@ -1188,8 +1188,9 @@ bool MemCpyOptPass::processMemCpyMemCpyDependence(MemCpyInst *M,
if (MDestOffset == MForwardOffset)
CopySource = M->getDest();
else {
- NewCopySource = cast<Instruction>(Builder.CreateInBoundsPtrAdd(
- CopySource, Builder.getInt64(MForwardOffset)));
+ NewCopySource = GetElementPtrInst::CreateInBounds(
+ Builder.getInt8Ty(), CopySource, Builder.getInt64(MForwardOffset), "",
+ Builder.GetInsertPoint());
----------------
nikic wrote:
This is going to miss the debug location. I'd prefer to keep IRBuilder and use a dyn_cast. If it's a constant, then there is no need to clean up.
https://github.com/llvm/llvm-project/pull/98686
More information about the llvm-commits
mailing list