[PATCH] D69606: [MachineBasicBlock] Skip over debug instructions in computeRegisterLiveness before checking for begin/end.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 16:59:53 PDT 2019


efriedma added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineBasicBlock.cpp:1410-1411
+  // Skip over debug instructions.
+  if (I != end() && I->isDebugInstr())
+    ++I;
+
----------------
craig.topper wrote:
> yechunliang wrote:
> > Does this code duplicated with the line: 1392-1394?
> > 
> > ```
> >  for (; I != end() && N > 0; ++I) {
> >     if (I->isDebugInstr())
> >       continue;
> > ```
> > 
> But that code stops when N is 0. So we can exit the loop without being at end() and have debug instructions after right?
Yes, but it's probably better to refactor the loop to use an an early exit, or something like that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69606





More information about the llvm-commits mailing list