[PATCH] D83468: [Debuginfo] Fix for PR46653

Jaydeep Chauhan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 11:37:33 PDT 2020


Jac1494 added a comment.

In D83468#2177491 <https://reviews.llvm.org/D83468#2177491>, @aprantl wrote:

> Thanks for posting the line table. It appears to confirm my suspicion that this patch merely hides the issue, but it isn't correct. To be sure it may be possible to preserve the debug location in this function, but implicitly setting it to the location of the instruction before it, is not the right thing to do. It may have the desired effect in your example, but it't not generally correct.

@aprantl Thank you for comment .  Line llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp:2187

  EntryBuilder->setDebugLoc(DebugLoc::get(0, 0, DL.getScope(), DL.getInlinedAt())); 

is setting Debug location for Line number zero , because of that AsmPrinter is getting debug location for line number zero and it is adding this entry into debug_line table . And this case is not there with SelectionDAG/FastIsel so it is working fine.

   llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  ...
    if (DL == PrevInstLoc) { // Checking for DL(DebugLoc) is give location which is zero in case of SelectionDAG/FastIsel
      // If we have an ongoing unspecified location, nothing to do here.
      if (!DL)            //SelectionAG/FastIsel will return 
        return;
      // We have an explicit location, same as the previous location.
      // But we might be coming back to it after a line 0 record.
      if (LastAsmLine == 0 && DL.getLine() != 0) {
        // Reinstate the source location but not marked as a statement.
        const MDNode *Scope = DL.getScope();
        recordSourceLine(DL.getLine(), DL.getCol(), Scope, /*Flags=*/0);
      }
      return;
    }
   ... 

And If we use gnu-as with clang (option -no-integrated-as) than it is remove line number zero entry from debug_line table.
So what is proper place to fix this issue compiler side or builtin assembler...?


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

https://reviews.llvm.org/D83468



More information about the llvm-commits mailing list