This is an archive of the discontinued LLVM Phabricator instance.

Add new debug kind LocTrackingOnly.
ClosedPublic

Authored by dnovillo on Jun 20 2014, 11:48 AM.

Details

Summary

This new debug emission kind supports emitting line location
information in all instructions, but stops code generation
from emitting debug info to the final output.

This mode is useful when the backend wants to track source
locations during code generation, but it does not want to
produce debug info. This is currently used by optimization
remarks (-pass-remarks, -pass-remarks-missed and
-pass-remarks-analysis).

To prevent debug info emission, DIBuilder never inserts the
annotation 'llvm.dbg.cu' when LocTrackingOnly is enabled.

Diff Detail

Repository
rL LLVM

Event Timeline

dnovillo updated this revision to Diff 10699.Jun 20 2014, 11:48 AM
dnovillo retitled this revision from to Add new debug kind LocTrackingOnly..
dnovillo updated this object.
dnovillo edited the test plan for this revision. (Show Details)
dnovillo added reviewers: echristo, dblaikie.
dnovillo added a subscriber: Unknown Object (MLST).
dblaikie edited edge metadata.Jun 20 2014, 11:55 AM

Probably worth wiring up the command line support in the same patch &
including test coverage.

I'd probably start with the LLVM change (using a local Clang change to
generate IR, or just hand-hacking the removal of the llvm.dbg.cu node
in an IR sample) to make sure this strategy is plausible and that just
dropping the llvm.dbg.cu node is all that's required from the
front-end.

Have you tested this through LLVM? How's it look?

dnovillo updated this revision to Diff 10703.Jun 20 2014, 1:04 PM
dnovillo edited edge metadata.

Add missing test.

Instead of adding the new test I was working on, I opted to make a smaller
change and modify an existing one. We already had a test with debug info
in it. I changed it so it is missing llvm.dbg.cu.

The test now checks:

1- That a missing llvm.dbg.cu does not prevent line location tracking from

emitting proper locations with -pass-remarks.

2- That the final output contain no debug information in it.

As to the other comments about whether to add a value to the enum or use a flag in createCompileUnit - for now I think I'm going to err on the side of preferring a flag in createCompileUnit.

The Clang-side support for this should obviously look a fair bit like GMLT (indeed if you put the enum value for this mode before GMLT, it should get most/all the right behavior by default (though you might have to fix up some comparisons for == GMLT to <= GMLT)). At some point we can probably simplify this even further so all the scopes are just simple line/file info without having to create any compile units, functions, lexical scopes, etc.

test/Transforms/LoopVectorize/X86/vectorization-remarks.ll
7 ↗(On Diff #10703)

My instinct would've been to -filetype=obj and run this through objdump -h and FileCheck that instead, but this seems OK too.

9 ↗(On Diff #10703)

You don't need the {{.*}} on either side here, FileCheck looks for subline matches by default (which is why the .loc as you've written it is correct).

dnovillo updated this revision to Diff 10758.Jun 23 2014, 8:37 AM
  • Remove DebugEmissionKind::LocTrackingOnly. Instead, add a boolean flag to DIBuilder::createCompileUnit.
  • Fix expected pattern in test.
emaste added a subscriber: emaste.Jun 23 2014, 9:29 AM
dblaikie accepted this revision.Jun 23 2014, 1:31 PM
dblaikie edited edge metadata.
dblaikie added inline comments.
include/llvm/IR/DIBuilder.h
112 ↗(On Diff #10758)

I wonder if there's a less vague name we could use for this parameter, but I haven't thought of a better one yet. (I imagine inverted would make more sense - true for "use this weird thing where we make metadata nodes but don't add the CUs to the list" - but still don't know what we'd name it)

This revision is now accepted and ready to land.Jun 23 2014, 1:31 PM
dnovillo closed this revision.Jun 24 2014, 10:10 AM
dnovillo updated this revision to Diff 10793.

Closed by commit rL211609 (authored by @dnovillo).