[llvm] [MemCpyOpt] Fix the invalid code modification for GEP (PR #68479)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 7 06:34:00 PDT 2023


================
@@ -1062,19 +1066,25 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
   // If necessary, perform additional analysis.
   if (isModOrRefSet(MR))
     MR = BAA.callCapturesBefore(C, DestWithSrcSize, DT);
-  if (isModOrRefSet(MR))
+  if (isModOrRefSet(MR)) {
----------------
dtcxzyw wrote:

Please add tests for these three cases which revert the code motion. I'm not sure an RAII guard is needed here. It will revert the change by default unless we explicitly keep the change in the end.


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


More information about the llvm-commits mailing list