[PATCH] D56135: Allow reverse iterators for `MachineBasicBlock::findDebugLoc` and `MachineBasicBlock::findPrevDebugLoc`

Artyom Goncharov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 6 12:45:34 PST 2019


m4yers marked 3 inline comments as done.
m4yers added a comment.

In D56135#1343674 <https://reviews.llvm.org/D56135#1343674>, @fhahn wrote:

> Are there any instances in the current codebase where this would be useful?


For example `X86InstrInfo::AnalyzeBranchImpl` can be rewritten with more natural reverse iterators.



================
Comment at: lib/CodeGen/MachineBasicBlock.cpp:1308
+  // Skip debug declarations, we don't want a DebugLoc from them.
+  MBBI = skipDebugInstructionsForward(std::prev(MBBI), instr_rend());
+  if (MBBI != instr_rend())
----------------
fhahn wrote:
> Should this be std::next here?
ah, true, thanks!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56135





More information about the llvm-commits mailing list