[PATCH] D119070: [MachineCombiner] Update iterator while deleting instructions

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 21 18:13:02 PST 2022


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineCombiner.cpp:489
   for (auto *InstrPtr : DelInstrs) {
+    // If the instructions to be deleted is pointed by cuurent iterator
+    // update the iterator.
----------------
Typo cuurent


================
Comment at: llvm/lib/CodeGen/MachineCombiner.cpp:492
+    if (InstrPtr == &*BlockItr) {
+      BlockItr++;
+    }
----------------
I've never looked at this pass before, but this looks like a strange structure. Why can't this pre-increment the iterator before making changes to the function?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119070/new/

https://reviews.llvm.org/D119070



More information about the llvm-commits mailing list