[PATCH] D78151: [AArch64InstrInfo] Ignore debug insts in canInstrSubstituteCmpInstr

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 13:49:41 PDT 2020


paquette added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:1450
     const MachineInstr &Instr = *I;
+    if (Instr.isDebugInstr())
+      continue;
----------------
fhahn wrote:
> It seems like a few similar changes popped up recently. It might be worth making it a bit easier to iterate over a range of MIs while skipping debug instructions automatically. It's quite easy to construct iterator ranges that skip debug instructions (see snippet below). It might be worth adding a helpers like that. They could also naturally be used for the existing skipDebugInstructionsBackward/skipDebugInstructionsForward
> 
> ```
> +  auto MIsWithoutDbg =
> +      make_filter_range(make_range(std::next(CmpInstr->getIterator()),
> +                                   CmpInstr->getParent()->instr_end()),
> +                        [](MachineInstr &I) { return !I.isDebugInstr(); });
> +  for (const MachineInstr &Instr : MIsWithoutDbg) {
> ```
+1, it seems like this is an extremely easy mistake to make, and it's probably peppered around basically everywhere.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78151





More information about the llvm-commits mailing list