[PATCH] D78265: [AArch64ConditionOptimizer] Fix missed optimization due to debug insts [10/10]

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 13:23:37 PDT 2020


vsk added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp:161
   // Now find the instruction controlling the terminator.
   for (MachineBasicBlock::iterator B = MBB->begin(); I != B;) {
+    I = prev_nodbg(I, MBB->begin());
----------------
fhahn wrote:
> Might be worth rewriting in terms of an iterator range, e.g. something like `reverseInstructionsWithoutDebug(I == MBB->begin() ? I : std::prev(I), MBB->begin())`
I have a mild preference for the current version as I feel that the ternary adds some complexity. Happy to change this though if anyone has a strong opinion otherwise.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78265





More information about the llvm-commits mailing list