[llvm] Reapply "[MemCpyOpt] support offset slices for performStackMoveOptzn and processMemCpy", with bug fixed (PR #180002)

Jameson Nash via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 06:16:37 PST 2026


================
@@ -1662,8 +1684,13 @@ bool MemCpyOptPass::performStackMoveOptzn(Instruction *Load, Instruction *Store,
 
   // Check that, from after the Load to the end of the BB,
   //   - if the dest has any Mod, src has no Ref, and
-  //   - if the dest has any Ref, src has no Mod except full-sized lifetimes.
-  MemoryLocation SrcLoc(SrcAlloca, LocationSize::precise(Size));
+  //   - if the dest has any Ref, src has no Mod except full-sized lifetimes
+  //   - from SrcPtr minus DestOffset to min(DestSize, SrcSize minus SrcOffset)
----------------
vtjnash wrote:

Agreed that it isn't exactly fitting with the other bullet points, but it isn't separate either: this is defining the term `src` used in the first two bullets in terms of `dest`, then the next bullet defines the term `dest` in terms of variables

https://github.com/llvm/llvm-project/pull/180002


More information about the llvm-commits mailing list