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

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 11:52:41 PDT 2020


paquette 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());
----------------
vsk wrote:
> 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.
It would be nice to be clear that we're skipping debug instructions in the loop header, I suppose?

I think in general it would be nice to avoid having to explicitly skip debug instructions within the loop itself.


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