[PATCH] D111223: [GlobalISel] Simplify RegBankSelect

Sebastian Neubauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 06:23:11 PDT 2021


sebastian-ne added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp:702
     MIRBuilder.setMBB(*MBB);
-    for (MachineBasicBlock::iterator MII = MBB->begin(), End = MBB->end();
-         MII != End;) {
-      // MI might be invalidated by the assignment, so move the
-      // iterator before hand.
-      MachineInstr &MI = *MII++;
+    SmallVector<MachineInstr *> WorkList;
+    for (MachineInstr &MI : reverse(MBB->instrs()))
----------------
foad wrote:
> Pass (MBB->instr_rbegin(), MBB->instr_rend()) into the constructor here?
I just tried and couldn’t get it working. I guess the iterator returns a `MachineInstr&` and no pointer, but `SmallVector<MachineInstr&>` doesn’t work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111223



More information about the llvm-commits mailing list