[PATCH] D88419: [RDA] Switch isSafeToMove iterators

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 01:18:05 PDT 2020


samparker added inline comments.


================
Comment at: llvm/lib/CodeGen/ReachingDefAnalysis.cpp:582
                                                 MachineInstr *To) const {
-  return isSafeToMove<MachineBasicBlock::iterator>(From, To);
+  using Iterator = MachineBasicBlock::reverse_iterator;
+  // Walk backwards until we find the instruction.
----------------
SjoerdMeijer wrote:
> This code is an exact copy of the previous one, except one iterator. This can probably be refactored into one `IsSafeToMove` function that gets passed in this iterator. But it's a nit, up to you if it is worth doing this.
I thought the same, but each loop uses different sentinels: begin/rbegin and end/rend and I didn't see a way to handle that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88419



More information about the llvm-commits mailing list