[PATCH] D111223: [GlobalISel] Simplify RegBankSelect

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 06:11:35 PDT 2021


foad 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()))
----------------
Pass (MBB->instr_rbegin(), MBB->instr_rend()) into the constructor here?


================
Comment at: llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp:708
+      MachineInstr &MI = *WorkList.back();
+      WorkList.pop_back();
 
----------------
I think there's a pop_back_value you can use.


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