This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Add debug locations to constant SD nodes continued
ClosedPublic

Authored by sdmitrouk on May 8 2015, 5:51 AM.

Details

Summary

Several updates for [DebugInfo] Add debug locations to constant SD nodes (r235989).
Includes:

  • re-enabling the change (disabled recently);
  • missing change for FP constants;
  • resetting debug location of constant node if it's used more than at one place to prevent emission of wrong locations in case of coalesced constants;
  • a couple of additional tests.

Now all look ups in CSEMap are wrapped by additional method. Not sure if it makes
sense in all cases, but at least this way we won't miss anything.

Possible question: why debug location isn't last parameter with default value in the
new method? Answer: because InsertPos is output parameter.

Comment in D9084 suggests that debug locations aren't useful for "target constants",
so there might be one more change related to this API (namely, dropping debug
locations for getTarget*Constant methods).

Diff Detail

Event Timeline

sdmitrouk updated this revision to Diff 25314.May 8 2015, 5:51 AM
sdmitrouk retitled this revision from to [DebugInfo] Add debug locations to constant SD nodes continued.
sdmitrouk updated this object.
sdmitrouk edited the test plan for this revision. (Show Details)
sdmitrouk added reviewers: echristo, dblaikie, rengolin.
sdmitrouk set the repository for this revision to rL LLVM.
sdmitrouk added subscribers: Unknown Object (MLST), keith.walker.arm.
dblaikie edited edge metadata.May 8 2015, 11:01 AM

FWIW I don't think LLVM has any rule that out/in parameters appear in any particular order (& even if it does' we could overload FindNodeOrInsertPos rather than having to add a default constructed DebugLoc() to so many call sites (at least at a glance it looks like a lot of them - what's the ratio/absolute number that are just passing the default?))

FWIW I don't think LLVM has any rule that out/in parameters appear in any particular order (& even if it does' we could overload FindNodeOrInsertPos rather than having to add a default constructed DebugLoc() to so many call sites (at least at a glance it looks like a lot of them - what's the ratio/absolute number that are just passing the default?))

13 of 40 calls use DebugLoc(). I'm happy to change the calls if default argument/overload looks better in your opinion, just wasn't sure about intermixing in/out arguments.

sdmitrouk updated this revision to Diff 25463.May 11 2015, 5:56 AM
sdmitrouk edited edge metadata.
sdmitrouk removed rL LLVM as the repository for this revision.

Added two-argument overload that asserts for opcode to be something other than Constant and ConstantFP.

sdmitrouk updated this revision to Diff 25464.May 11 2015, 6:10 AM
sdmitrouk set the repository for this revision to rL LLVM.

The same, but with new tests, lost untracked files in the previous revision. Sorry for the noise.

main code change looks reasonable with one minor change suggested

Do you have any stats on debug info size growth? A per-section breakdown/increase comparison of a clang bootstrap with -gmlt would be really handy.

lib/CodeGen/SelectionDAG/SelectionDAG.cpp
987

use llvm_unreachable rather than assert(false)

(alternatively, assert(N->getOpcode() != ISD::Constant && N->getOpcode() != ISD::ConstantFP && "..."))

sdmitrouk updated this revision to Diff 25575.May 12 2015, 4:36 AM

Use llvm_unreachable().

main code change looks reasonable with one minor change suggested

Changed to llvm_unreachable() in new revision.

Do you have any stats on debug info size growth? A per-section breakdown/increase comparison of a clang bootstrap with -gmlt would be really handy.

Changes are surprisingly small. I even wasn't sure I used correct executables during build, but it seems to be the case.

Changes of sections for clang binary built in debug mode in bytes (the rest of sections is unchanged):

section        before      after       change
.text          0x0374b513  0x0374b522  +0x000f
.rodata        0x0095fed1  0x0095fe91  -0x0040
.debug_info    0x1781dc27  0x1781dc41  +0x001a
.debug_abbrev  0x001d1940  0x001d193e  -0x0002
.debug_line    0x031745e3  0x03175800  +0x121d
.debug_str     0x0409248e  0x040923f5  -0x0099
.debug_ranges  0x00f5c530  0x00f5c560  +0x0030
.debug_loc     0x00023eb8  0x00023f00  +0x0048
dblaikie accepted this revision.May 12 2015, 10:04 AM
dblaikie edited edge metadata.

Great - thanks!

This revision is now accepted and ready to land.May 12 2015, 10:04 AM
This revision was automatically updated to reflect the committed changes.