[PATCH] D84397: [MSP430] Replace known epilogues with branches to __mspabi_func_epilog_N

Anton Korobeynikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 02:52:42 PDT 2020


asl requested changes to this revision.
asl added a comment.
This revision now requires changes to proceed.

Will you please switch to iterators here?

Thanks!



================
Comment at: llvm/lib/Target/MSP430/MSP430CommonEpilogueOptimizer.cpp:112
+
+  for (auto *MI = EpilogueBegin; MI != EpilogueEnd;) {
+    MachineInstr *InstrToRemove = MI;
----------------
I would not use low-level list-manipulating stuff here. Can we just use iterators here?

So we would have iterator to Begin, to End. In the for loop do something like this:


```
while (EpilogueBegin != EpilogueEnd) {
      MachineInstr *InstrToRemove = EpilogueBegin;
      EpilogueBegin = std::next(EpilogueBegin);
      // Do crazy removal
}
```


================
Comment at: llvm/lib/Target/MSP430/MSP430CommonEpilogueOptimizer.cpp:126
+  unsigned MatchedRegisters = 0;
+  for (auto *I = Terminator.getPrevNode();
+       I != nullptr && MatchedRegisters < array_lengthof(RestoredRegisters);
----------------
See above. Please use iterators.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84397



More information about the llvm-commits mailing list