This is an archive of the discontinued LLVM Phabricator instance.

Add new debug kind LocTrackingOnly.
ClosedPublic

Authored by dnovillo on Jun 20 2014, 11:49 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 (-Rpass, -Rpass-missed and -Rpass-analysis).

When one of the -Rpass flags is used, the front end will enable
line and column tracking, only if no other debug option is enabled.

Depends on D4234.

Diff Detail

Repository
rL LLVM

Event Timeline

dnovillo updated this revision to Diff 10700.Jun 20 2014, 11:49 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).
dnovillo updated this revision to Diff 10757.Jun 23 2014, 8:37 AM
  • Update call to DBuilder.createCompileUnit. Set new boolean flag to true only when DebugKind is not set to LocTrackingOnly.
  • Change equality checks for DebugLineTablesOnly to <= so they also include LocTrackingOnly values.
  • Update optimization remark test to check that no llvm.dbg.cu annotation is generated.
dblaikie added inline comments.Jun 23 2014, 11:08 AM
lib/CodeGen/CGDebugInfo.cpp
378 ↗(On Diff #10757)

I'd use <= here, though it doesn't really matter since this metadata should never end up being read/used in the LocTrackingOnly situation.

lib/Frontend/CompilerInvocation.cpp
571 ↗(On Diff #10757)

You only want to track column info if the user didn't request debug info? That seems like a strange limitation - the diagnostic quality will improve/change in non-debug builds?

test/Frontend/optimization-remark.c
11 ↗(On Diff #10757)

You should be able to test for the absence of any type information, for example (at a guess: CHECK-NOT: DW_TAG_basic_type) now that you've changed those couple of == GMLT to <= GMLT. If you undo those changes, add the CHECK-NOT I mentioned, verify the test fails, then reapply the changes, that'd be great.

dnovillo updated this revision to Diff 10761.Jun 23 2014, 1:22 PM
  • Check that -Rpass does not generate anything other than source locations.
dblaikie accepted this revision.Jun 23 2014, 1:30 PM
dblaikie edited edge metadata.

Looks good - though I'd prefer to separate the discussion about column info so as to isolate the changes/tests/etc and not delay this review.

lib/Frontend/CompilerInvocation.cpp
571 ↗(On Diff #10761)

Perhaps we could leave this out for now & just have a separate CR/discussion about the semantics/ramifications of having this difference between -R and -gmlt?

test/Frontend/optimization-remark.c
13 ↗(On Diff #10761)

Could have a brief comment here "Ensure -Rpass, like -gmlt, doesn't produce debug info metadata for types".

This revision is now accepted and ready to land.Jun 23 2014, 1:30 PM
dnovillo updated this revision to Diff 10768.Jun 23 2014, 2:55 PM
dnovillo edited edge metadata.
  • Do not enable column information when -Rpass is given.
dblaikie added inline comments.Jun 23 2014, 3:10 PM
lib/Frontend/CompilerInvocation.cpp
569 ↗(On Diff #10768)

You could roll these two 'if's together, if you like. (if ((x || y || z) && A == B)

Is there some more general check you could do for "OptimizationRemark" overall rather than having to check these 3 flags individually (& then have to update this ewhenever other similar flags are added?)

dnovillo updated this revision to Diff 10787.Jun 24 2014, 6:39 AM
  • Simplify loc tracking test.
echristo accepted this revision.Jun 24 2014, 9:50 AM
echristo edited edge metadata.

LGTM.

dnovillo closed this revision.Jun 24 2014, 10:10 AM
dnovillo updated this revision to Diff 10794.

Closed by commit rL211610 (authored by @dnovillo).