[LLVMbugs] [Bug 23837] New: [META] Fix as many instructions with missing DebugLoc as possible.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 12 15:58:46 PDT 2015


            Bug ID: 23837
           Summary: [META] Fix as many instructions with missing DebugLoc
                    as possible.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Miscellaneous Instrumentation passes
          Assignee: unassignedbugs at nondot.org
          Reporter: vonosmas at gmail.com
                CC: dblaikie at gmail.com, echristo at gmail.com,
                    llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Generally, LLVM does very bad job in ensuring that, when debug info is enabled
(-gline-tables-only or above), all necessary([1]) instructions indeed have
DebugLoc attached to them, or that DebugLoc are preserved as we transform the
code. For example:

* DebugLoc can be easily missed as we split/rearrange basic blocks.
* Synthesized instructions in GVN, SCEV etc. often have no debug info.

Once we have an instruction I with no DebugLoc, this "missing" DebugLoc would
propagate through the program - e.g. every time we construct IRBuilder<> with I
as insertion point, it will fail to set correct DebugLoc for instructions it

This is painful - with optimizations enabled, we may often fail to provide
reasonable line info for instructions, or (worse case, which often happens)
incorrectly return line info for *some* preceding instruction which happened
to have DebugLoc, but may be completely irrelevant (e.g. come from a
different inlined subroutine).

I've did several improvements recently:

But there are many more cases to fix, and even if we fix them all,
we should be able to somehow prevent further breakages.
* We can improve API for creating new instructions that would force callers
  to set DebugLoc (or explicitly pass empty one, promising to set it up later).
* Add module verifier check that would enforce that if function has *some*
  attached DebugLocs, then all ([1]) instruction should have them.
* Add asserts to places where we believe DebugLoc should always be present if
  line tables are enabled (e.g. we need it in SanitizerCoverage pass where
  we know that PCs of certain instructions would be collected, and possibly
  symbolized later).
* Some combination of above.

[1] - Function prologue instructions (alloca's etc.) intentionally have no
DebugLoc. PHI nodes *sometimes* do have them, but it's not clear whether
there's a contract of some sort. Many users actually call
BB->getFirstNonPHI()->getDebugLoc() to get the "entry" debug location, probably
because they believe it will be the first insertion point / non-transient

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150612/e0723ca2/attachment.html>

More information about the llvm-bugs mailing list