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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 08:06:13 PDT 2019


craig.topper marked an inline comment as done.
craig.topper added a comment.

In D69606#1726744 <https://reviews.llvm.org/D69606#1726744>, @yechunliang wrote:

> Will it be better to use getFirstNonDebugInstr() instead of begin() on line 1475?
>
>   // Did we get to the start of the block?
>   -   if (I == begin()) {
>   +   if (I == getFirstNonDebugInstr()) {
>   


Not sure.  I guess it depends on whether its more likely that there are debug instructions at the beginning of the block or the current iterator. If we use getFirstNonDebugInstr we're starting a separate scan from the beginning of the block. The code I have here starts from the current iterator.



================
Comment at: llvm/lib/CodeGen/MachineBasicBlock.cpp:1410-1411
+  // Skip over debug instructions.
+  if (I != end() && I->isDebugInstr())
+    ++I;
+
----------------
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?


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