[PATCH] D24180: Emit 'no line' information for interesting 'orphan' instructions

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 11:31:26 PST 2016


probinson added a comment.

I was wondering if maybe I should restructure the DwarfDebug.cpp bit.  Currently it's like

  beginInstruction() {
    if (!MI->isDebugValue()) {
      if (DL != PrevInstLoc) {
        if (DL) {
          // case for a new, explicit location
        } else if (somewhat complicated condition) {
          // case for emitting line-0
        }
      } else if (DL) {
        if (DL.getLine() != LastAsmLine) {
          // case for restoring a previous line after emitting line-0
        }
      }
    }
  } // end of function

and this could easily be redone as a sequence of much-less-indented cases:

  beginInstruction() {
    if (MI->isDebugValue())
      return;
    if (DL == PrevInstLoc) {
      if (DL && DL.getLine() != LastAsmLine) {
        // case for restoring a previous line after emitting line-0
      }
      return;
    }
    // DL != PrevInstLoc
    if (DL) {
      // case for a new, explicit location
      return;
    }
    if (somewhat complicated condition) {
      // case for emitting line-0
    }
  }

Would that help?  The diff would be harder to read but the result might make more sense.


https://reviews.llvm.org/D24180





More information about the llvm-commits mailing list